Use 'net.zetetic:android-database-sqlcipher:3.5.6@aar' open 1x.db

Hello,I used v3.5.6 open 1x.db database,the password is true,Why is it wrong?What should I do?Thanks


The following error occurred at run time
“net.sqlcipher.database.SQLiteException: file is encrypted: or is not a database”

@lovezmcs What version of SQLCipher created 1x.db?

Hi,I used your Demo,the url ‘https://github.com/sqlcipher/sqlcipher-android-tests/blob/master/src/main/java/net/zetetic/tests/AttachExistingDatabaseTest.java

The db file ‘https://github.com/sqlcipher/sqlcipher-android-tests/tree/master/assets

@lovezmcs. In that case you would also need to disable HMAC in your postKey:

https://www.zetetic.net/sqlcipher/sqlcipher-api/#cipher_use_hmac

Hi @lovezmcs

If you are attempting to access a 1.x database file, not only would you need to adjust the KDF iteration length as you are, you will also need to disable the HMAC page checking behavior the newer versions of the library perform. Please see this for reference. Alternatively, we would recommend utilizing the PRAGMA cipher_migrate; option within the postKey event of your database hook, an example can be found here.

Thanks,I tried it


I don’t want to use the’PRAGMA cipher_migrate; 'because it will make the old project can’t run, what should I do?

Thanks,I don’t want to use the’PRAGMA cipher_migrate; 'because it will make the old project can’t run, what should I do?

If you’re using postKey use Pragma kdf_iter instead of cipher_default_kdf_iter.

Thanks so much,now is ok.You are a good man…

1 Like