Search code examples
opensslsqlciphercommoncrypto

SQCipher : OpenSSL to CommonCrypto


Just installed the last version of sqlcipher library into my iOS project. So I switch from OpenSSL to CommonCrypto (the sqlcipher iOS tutorial has changed too).

Now, I get a "DB Error: 26 "file is encrypted or is not a database". It seems the new encrypt engine using CommonCrypto does not recognize my db file previously encrypted with OpenSSL and using SQLCipher in the 2 cases. Of course, the db key is the same...

Is-it logical ? Should I keep OpenSSL ?


Solution

  • Your existing database file was likely created using either the 1.x or 2.x SQLCipher file format. If this is the case, you can either upgrade your existing database file, or decrease the key derivation iteration length used by the new library to match your existing database format. More details can be found here.