Search code examples
androidsqlite64-bitsqlcipher-android

Android SQLite file encryption


I'm building an SDK to be used in a hosting app. This SDK includes working with DB using SQLite.

One of the requirements, is that the DB will be encrypted in order to prevent pulling the SQLite database from the device and using the user private information.

I started to work with SQLCipher, but there is no support for 64bit architecture devices, which causing the application to crash.

I checked some other possibilities, but all of them causing other issues that I decided to try handle it by myself.

My questions:

  1. Does Android have some encryption mechanism for DB files?
  2. Can I encrypt the file when the application starts, and decrypt it again when the application is closing? I know that in iOS there is some kind of possibility called NSFileProtection
  3. Do you know other library that can handle the DB encryption, that supports 64bit devices?
  4. Do you know if there is an Android solution for this, without using JNI(javax.crypto)?

I'll be happy to get any information or help.


Solution

  • there is no support for 64bit architecture devices

    SQLCipher works fine on the 64-bit devices that I have used it on. I seem to recall some issues with some apps that had multiple NDK libraries/code, where some had 64-bit libraries and some did not, where there were issues. I would suggest that you open separate Stack Overflow questions, or use other support resources (e.g., SQLCipher's support board), to get to the bottom of your difficulties.

    Does Android have some encryption mechanism for DB files?

    No.

    Can I encrypt the file when the application starts, and decrypt it again when the application is closing?

    No, for several reasons, not the least of which is that applications do not close on Android.

    Do you know other library that can handle the DB encryption, that supports 64bit devices?

    No, and asking for off-site resources is considered to be off-topic for Stack Overflow, anyway.

    Do you know if there is an Android solution for this, without using JNI(javax.crypto)?

    This is the same as the first and third questions.