I have a database file reset in the assets file.
How can I use SQLCipher to encrypt the database in android?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is going to be a bit complicated. Since the database file format is different between SQLite and SQLCipher for Android, and since you want to ship an unencrypted database, you will have to do a few things.
First, I’d get
SQLiteAssetHelpergoing, to deliver the unencrypted database to your environment.Then, use standard SQLCipher for Android to create an empty-but-encrypted database.
Next, you will need to implement the code to copy the data out of the packaged-but-unencrypted database and insert it into the empty-but-encrypted database.
Once that is all done, you can close and delete the packaged-but-unencrypted database and just use the encrypted one.
This might make a useful extension to
SQLiteAssetHelper, someday…