0

We are developing Xamarin.forms application and we have to encrypt our database. While googling I found something is 'PRAGMA key'. When I started using this in my code then on opening the db file via any browser I get a dialog box to enter the Passphrase.

My question here is, does 'PRAGMA key' encrypt whole database or it just works like a password to open the database file.

Any help is greatly appreciated.

user369182
  • 1,995
  • 4
  • 16
  • 17

1 Answers1

0

Without a version of SQLite that includes SQlite Encryption Extension (SEE), the pragma will be ignored.

With SEE included the entire database is encrypted. It is possible to put together code that could be used to encrypt specific columns without using SEE.

MikeT
  • 51,415
  • 16
  • 49
  • 68
  • Mike, I am using sqlite-net-pcl(1.5.231)..Does this support SSE? How should I verify? But when I open this Database file(created with use of PRAGMA key) with any browser then it asks for Passphrase, Does this mean file is encrypted? – user369182 Dec 12 '18 at 05:15
  • @user369182 I doubt that it would be as SEE requires a license. *The core SQLite library is in the public domain. However, the extensions needed to read and write an encrypted database file are licensed software. You should only be able to see this software if you have a license*[License](https://www.sqlite.org/see/doc/trunk/www/readme.wiki) – MikeT Dec 12 '18 at 05:51
  • I completely agree with you, but with 'sqlite-net-pcl' in PCL project and 'SQLitePCLRaw.bundle_sqlcipher' in Android project, when I open database file(created with PRAGMA key) in any db browser then it ask for Passphrase...If public domain library ignores PRAGMA then why browser ask for Passphrase?.. – user369182 Dec 12 '18 at 06:31