I’m using SQLCipher for android Implementation-Version: v3.5.4-5-g87be8c4
I’m getting below crash reports from play store of customers but stacktrace doesn’t give much information.
at net.sqlcipher.database.SQLiteCompiledSql.native_compile (
at net.sqlcipher.database.SQLiteCompiledSql.compile (
at net.sqlcipher.database.SQLiteCompiledSql. (
at net.sqlcipher.database.SQLiteProgram. (
at net.sqlcipher.database.SQLiteQuery. (
at net.sqlcipher.database.SQLiteDirectCursorDriver.query (
at net.sqlcipher.database.SQLiteDatabase.rawQueryWithFactory (
at net.sqlcipher.database.SQLiteDatabase.rawQuery (
at net.sqlcipher.database.SQLiteDatabase.keyDatabase (
at net.sqlcipher.database.SQLiteDatabase.openDatabaseInternal (
at net.sqlcipher.database.SQLiteDatabase.openDatabase (
at net.sqlcipher.database.SQLiteDatabase.openDatabase (
at net.sqlcipher.database.SQLiteOpenHelper.getReadableDatabase (
at net.sqlcipher.database.SQLiteOpenHelper.getReadableDatabase (

Generally there is message logged like “file is encrypted or not a database” which could lead opening db with wrong key.
I’m looking for what are possible scenarios when actual message is not logged in stacktrace ?

Hi @payas_gupta

It would depend on how your application handles exceptions. SQLCipher for Android will always throw an exception when you attempt to open the database with an invalid password. As an aside, you might consider updating your library, we’ve had several improvements to the library since 3.5.4, which is currently 3.5.9.

Thanks for the reply, I will update libraries. My application doesn’t suppresses exception message and it logs every stacktrace possible. As you can see from above log snippet exception came in sqlcipher library for which actual cause is not present. I’m just curious what could be possible scenario where actual message is not logged.

Hi @payas_gupta

Unfortunately, there are many possible reasons that SQLCipher may not be able to open a file. Providing an invalid password is the most typical scenario, however other issues could arise in which SQLCipher is not able to determine the root cause. For example, if you provide the path to a corrupt database, SQLCipher may not be able to open it.

Not being able to access the database should always cause an exception to occur. Within the SQLCipher for Android test suite we have tests around invalid open arguments and invalid passwords as an example.