Encryption with sqlcipher on Android

Now that I have updated my Android app to use CBLite 1.2, I’m trying to enable encryption in my app using sqlcipher. I have read that sqlcipher is integrated in CLB 1.2 for Android and I saw a few examples of it being used in the sample GroceryApp, but this documentation page really only has instructions for integrating with Xcode (I’m using Android Studio) and there aren’t even Java code samples for each of the sections.

So far, I’ve added sqlcipher to the project by putting this line in my build.gradle dependencies:

compile ‘com.couchbase.lite:couchbase-lite-android-sqlcipher:1.2.0’

I’ve also updated my database initiation to look like this:

DatabaseOptions options = new DatabaseOptions();
database = manager.openDatabase(DATABASE_NAME, options);

This is all I can figure out to do so far, based on the documentation I’ve seen. My app still works normally, I feel doubtful that encryption is enabled now since this is all I changed, but I’m not even sure how to check if its encrypted or not. And I’m not sure how to proceed without further documentation. Advice?

1 Like

Hi @jhampton,

Sorry for lack of Java samples in our documentation.

To verification if the database is encrypted, you could use different key to open the database.

Thank you