6

I'm using System.Data.SQLite to create an encrypted SQLite database in a WPF project. The encryption is done by providing a password in the connection string just like this one:

new SQLiteConnection("Data Source=database.sqlite;Password=123456;Version=3;New=false;Compress=True;);

This works well but since the database is encrypted now I'm not able to open it anymore with tools like DB Browser for SQLite or SQLiteStudio. SQLite Studio offers the possibility to open a database of type SQLCipher but I'm struggling to provide the correct settings for my database to open.

Does anybody know how to open an encrypted SQLite database, so I can inspect the data in it?

stefan
  • 658
  • 2
  • 9
  • 31
  • The whole point of encrypting a database is so that it can't be opened by general-purpose browser tools. Just create it without the password and then inspect it. – Mark Benningfield Mar 01 '18 at 23:13
  • 1
    Right, but during development it would be nice to sometimes take a look at the data without having to change my code and since I know the password I use to encrypt my DB it should be somehow possible to open it. – stefan Mar 02 '18 at 08:02
  • If you're creating database with System.Data.SQLite, then you should use System.Data.SQLite plugin in SQLiteStudio for it. There is such plugin. If you use SQLCipher you won't be able to open it, because SQLCipher is completely different solution for database encryption and it's incompatible. – Googie Mar 02 '18 at 09:10
  • @Googie: Could you point me to where I can find the plugin. I wasn't able to find it with a quick google search... – stefan Mar 06 '18 at 13:43
  • @stefan: it is included in standard SQLiteStudio package (assuming you're running version 3.1.1). – Googie Mar 08 '18 at 21:11

1 Answers1

1

I was the same problem with SQLiteStudio, in my case, I resolved using the following configuration for SQLChiper:

PRAGMA kdf_iter = '64000';
PRAGMA cipher_page_size = 1024;
PRAGMA cipher_hmac_algorithm = HMAC_SHA1;
PRAGMA cipher_default_kdf_algorithm = PBKDF2_HMAC_SHA1;

On the SQLiteStudio would be like: enter image description here

For extra configuration or other possible parameters, you could visit the following link https://www.zetetic.net/sqlcipher/sqlcipher-api/