There is a 2.x.db database file, using sqlcipher for Android v3.5.4 to modify the content, and forward compatible “PRAGMA cipher_migrate;”, after using the v2.x SDK cannot open, “net.sqlcipher.database.SQLiteException: file is encrypted: or is not a database” but the use of v3.x SDK can open. Is there any way not to upgrade the database? Thanks
Hello @Slice1129
If you have a 2.x database (i.e., it was created using SQLCipher 2.x), you can perform a one-time upgrade of the database file to the 3.x file format, using the 3.x version of SQLCipher for Android. You would do so using the PRAGMA cipher_migrate;
command mentioned above. Is there anything that would prevent you from upgrading your SQLCipher for Android library to the latest version, currently 3.5.6?
Thank you,Now the main problem is like this: I used the 3.x version to open the 2.x version, resulting in automatic database upgrade, encryption algorithm has changed, please tell me how to make encryption algorithm does not change?
If you want to use SQLCipher 3.x but use the 2.x settings, you’ll need to use PRAGMA kdf_iter
or PRAGMA cipher_default_kdf_iter
to adjust the KDF iterations to 4,000, which would match the SQLCipher 2.x settings.