A.G.
A.G.

Reputation: 1319

SQLCipher v3.2.0 can't open databases created with SQLCipher v2.1.1

I've compiled SQLCipher v3.2.0 using the SQLCipher GIT repository, mingw32 and this how-to. I did succeded to get a working sqlite3.dll that can create crypted and uncrypted databases.

But when I try to open encrypted databases that were created with SQLCipher v2.1.1, it fails to open the databases. I also tried to open the databases created with SQLCipher v3.2.0 using SQLCipher v2.1.1 and it fails too.

I guess the issue is about the default cipher algorithm used by SQLCipher v3.2.0 and the one used by SQLCipher v2.1.1.

Using the source files available on the GIT repository, I checked the default cipher algorithm that was used with SQLCipher v2.1.1 which was AES-256-CBC using a key of 64 (byte/bit). SQLCipher v3.2.0 seems to use the same default algorithm.

SQLCipher v2.1.1 was a static version bought on zetetic.net two years ago.

Is there a way to check with what algorithm the databases were encrypted ? I guess no.

Do you guys think it a cipher algorithm selection issue ? or something else ?

Thanks.

Upvotes: 1

Views: 550

Answers (1)

Nick Parker
Nick Parker

Reputation: 1388

The 3.x version of SQLCipher can operate on a 2.x database, however the key derivation length was increased from 4,000 to 64,000 which is likely why you are seeing a problem. You can perform a one time upgrade of the 2.x database file by issuing the following command after you have keyed the database:

PRAGMA cipher_migrate;

An alternative would be to adjust the kdf_iter value down to 4000. More information regarding these options is available on the blog post covering the 3.0.0 release.

Upvotes: 2

Related Questions