# Which tool can open encrypted DB

**URL:** <https://forum.duplicati.com/t/which-tool-can-open-encrypted-db/2372>\
**Category:** Developer\
**Created:** [February 6, 2018, 8:51am UTC](https://forum.duplicati.com/t/which-tool-can-open-encrypted-db/2372 "2018-02-06T08:51:07Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![surlyhacker](https://forum.duplicati.com/letter_avatar_proxy/v4/letter/s/8e7dd6/32.png) [@surlyhacker](https://forum.duplicati.com/u/surlyhacker)\
**Post date:** [April 30, 2022, 7:11pm UTC](https://forum.duplicati.com/t/which-tool-can-open-encrypted-db/2372/17 "2022-04-30T19:11:40Z")

</div>

As far as I can tell, the `Duplicati-server.sqlite` is encrypted using the “SQLite Encryption Extension” (SEE), which is actually a paid extension to SQLite. However, there is a freely available implementation in the `System.Data.SQLite` .NET library, which is of course distributed with Duplicati. So I found the easiest way to query this database (assuming you don’t want to have Duplicati permanently unencrypt it) is to copy the file somewhere and use this Powershell code on Windows to decrypt that copy, which you can then open with your SQLite browser/tool of choice.

Here is the Powershell code to decrypt:

```nohighlight
[Reflection.Assembly]::LoadFile("C:\Program Files\Duplicati 2\System.Data.SQLite.dll")

$sDatabasePath="C:\Temp\duplicati-test\Duplicati-server2.sqlite"
$sDatabaseConnectionString=[string]::Format("data source={0}",$sDatabasePath)
$oSQLiteDBConnection = New-Object System.Data.SQLite.SQLiteConnection
$oSQLiteDBConnection.ConnectionString = $sDatabaseConnectionString
$oSQLiteDBConnection.SetPassword("Duplicati_Key_42")
$oSQLiteDBConnection.open()

$oSQLiteDBConnection.ChangePassword("")
$oSQLiteDBConnection.close()

```

Of course, you should replace the path in the `LoadFile` line to correspond to your Duplicati install.  
And replace the path in the value of `$sDatabasePath` with the place where you’ve put the copy of the database.

Yes, the default password (unless you changed it) is “Duplicati\_Key\_42”

Credit: Got some example code from here: [Powershell: Working with a SQLite Database](https://michlstechblog.info/blog/powershell-working-with-a-sqlite-database/)

Ancient C# example: [Encrypting, decrypting and attaching to encrypted databases - System.Data.SQLite](http://web.archive.org/web/20071016123701/http://sqlite.phxsoftware.com/forums/t/130.aspx)  
Code that does this in Duplicati: [duplicati/SQLiteLoader.cs at de13cbcbd0f85492e8b8603def0ced7d7472a8e4 · duplicati/duplicati · GitHub](https://github.com/duplicati/duplicati/blob/de13cbcbd0f85492e8b8603def0ced7d7472a8e4/Duplicati/Library/SQLiteHelper/SQLiteLoader.cs#L47)

I guess the method was removed in later releases (see below)

Duplicati 2.0.6.3 is distributed with System.Data.SQLite 1.0.111.0

For historical auditing purposes, it seems that starting with System.Data.SQLite **version 1.0.113.0, support for encryption was entirely removed** in this checkin:  
[https://system.data.sqlite.org/index.html/info/56170d1316782f1b](https://system.data.sqlite.org/index.html/info/56170d1316782f1b)  
by modifying the file `/Targets/SQLite.NET.Settings.targets`, and setting the value of `InteropCodec` to false.  
specifically the comment says “Merge all changes needed for the SQLite core library 3.32.0 release.”  
Which reveals to us that the actual culprit is SQLite itself, where in **release 3.32.0, they removed support for encryption as well** , in this commit:  
[https://www.sqlite.org/src/info/5a877221ce90e752](https://www.sqlite.org/src/info/5a877221ce90e752)  
Where the comment says “ **simplify the code by removing the unsupported and undocumented SQLITE\_HAS\_CODEC compile-time option** ”

**Neither the change in System.Data.SQLite nor in SQLite are documented in the release notes for these projects.**

---

_[View the full topic](https://forum.duplicati.com/t/which-tool-can-open-encrypted-db/2372)._
