Converting the existing database to use SQL cipher library
andrejc opened this issue · 4 comments
Hi,
I was wondering if there is an easy way to update the app which is already using an unencrypted SQLite database to use the ciphered one? Obviously, one could load each value from the database manually, encrypt it and then write it back and then continue using the library in a standard way, but is there a more straightforward way?
Thanks,
Andrej
SQLCipher should be able to open a normal SQLite database, then just 'rekey' it. Or you could export the db to SQL, and import it.
Yes, interesting use case. We don't currently support opening a db with providing an initial key. We should write a test for this!
More on this... you can definitely do this via command line sqlite/sqlcipher, but not via the current API.
I will ask the SQLCipher core team if you can just "rekey" an existing database, to see if that is enough.
http://stackoverflow.com/questions/311691/importing-a-sqlite3-dump-back-into-the-database
Hi andrejc,
We have added a convenience function called sqlcipher_export() to do this very thing. Documentation on usage can be found here: