Android Question SQLCipher won't open encrypted db

baron

Member
Licensed User
Longtime User
I've been using B4A for a few months now and made great progress. My app uses a SQLite database and works well, but encryption was requested by the client, so I bought the SQLCipher.net libraries (Vr 3.8.0.2 from Zetetic) and created an encrypted version of my db. The command line utility shows the db is OK.

I downloaded the SQLCipher library and copied the contents of the libraries folder to the Basic4Android Libraries folder, and copied icudt46l.zip to the Files folder of my project (and added it to the project). I then added the SQLCipher library to the project, added an instance of SQLCipher and used it instead of the SQL object to open the database - adding the password parameter. The original SQL object remains in the project. It fails to open the encrypted database - "database is encrypted or not a database file".

I have written a quick test project to double-check, and it doesn't work either. I noticed the Zetetic website offered free Android binaries, so downloaded them. I tried their version of icudt46l.zip - no difference, then overwriting the B4A SQLCipher jar files with theirs. The project doesn't then compile - at the Java stage, it says that SQLCipher is missing. I noticed that no XML files were included in the Zetetic download.

Have I missed something ?
 

baron

Member
Licensed User
Longtime User
The B4A SQLCipher library is a wrapper above their Android library. It is based on version 2.x. Can you downgrade the desktop version to this version?

I remember that there were some compatibility issues with their latest version.

I have requested a copy of SQLCiper.net Vr 2.x. When do you think you can produce a Vr3.x - compatible library for B4A ? Your tutorial on SQLCipher recommends buying from Zetetic, so others will have the same problem.
 
Upvote 0

baron

Member
Licensed User
Longtime User
Nick Parker from Zetetic responded as below. I can't answer the Android bits of their questions, although they know that I used SQLCipher 3.8.0.2 to create the database.

This sounds as if it may be a project integration issue. I have a few questions below that will help shed a bit of light on what might be going on. The error message you received from SQLCipher for Android could be related to a few different things. Also, please note we have a SQLCipher for Android test suite [1] that runs as a standard Android application, could you clone the repo and attempt to run it locally?
I can't answer the Android bits of their questions, although they know that I used SQLCipher 3.8.0.2 to create it.

  1. Could you explain the process you went through integrating SQLCipher for Android within your application?
  2. What version of SQLCipher was used to create the database file you are attempting to open on your Android device?
  3. What version of SQLCipher for Android are you using on your Android device?
  4. Do you have any customizations of SQLCipher, (i.e., non default cipher, kdf iteration length, page size, etc)?
  5. https://github.com/sqlcipher/sqlcipher-android-tests
 
Upvote 0
Top