Reputation: 15615
I have an app already published in Play Store. Now, I want to encrypt the database of the app.
I know about SQLCipher for Android which can do this for me. But the problem is that my app is already used by a lot of users and they have lots of unencrypted data inside it.
Now, how can I use SQLCipher with an existing unencrypted database? So that all my previous data gets encrypted without any problem and new data gets going as it should.
Upvotes: 0
Views: 720
Reputation: 21766
You can encrypt a plaintext database using SqlCipher using the following commands or alternatively you can find Java example code on GitHub.
$ ./sqlcipher plaintext.db
sqlite> ATTACH DATABASE 'encrypted.db' AS encrypted KEY 'testkey';
sqlite> SELECT sqlcipher_export('encrypted');
sqlite> DETACH DATABASE encrypted;
You can encrypt the user's database as part of the installation of your new app by overriding the onUpgrade method in your installer.
Upvotes: 0