SQLCipher Migration From 3.4.1 to 4x in iOS

Hi, i updated my SQLcipher library from 3.4.1 to 4x by using process mentioned below.

https://www.zetetic.net/sqlcipher/ios-tutorial/

So, finally i replaced sqlite3.c & sqlite3.h files & changed Other C Flags also. But, am not able to get my previous data.

I also replaced EncryptedStore.h & EncryptedStore.m files.

Can you please let me know how migration process will work in iOS & what steps to be followed for this upgradation correctly with out loosing my old data.

Hi @umeshchalla

the Project iMAS encrypted core data project is separate from SQLCipher. Because of that we don’t have a recommendation as far as updating it to use the latest version of SQLCipher. Our general recommendations for updating from SQLCipher 3 to SQLCipher 4 can be found here: Upgrading to SQLCipher 4

Hi @mmoore

Note: Am using CoreData.

Where should we use PRAGMA key = ‘’ & PRAGMA cipher_migrate exactly in Objective C. As i initially used EncryptedStore.h & EncryptedStore.m files for 3x. Is it possible for migration from 3x to 4x by removing (EncryptedStore.h & EncryptedStore.m) And use Upgrading to SQLCipher 4. Can you please share some example.

@umeshchalla

As I mentioned in my initial response, the Encrypted Core Data project you reference is separate from SQLCipher (although it does internally use SQLCipher). Because of this, we don’t have recommendations on how to upgrade from SQLCipher 3 to SQLCipher 4 using Encrypted Core Data. You may try asking the Encrypted Core Data project where the appropriate place to do cipher_migrate may be.

Where should we use PRAGMA key = ‘’ & PRAGMA cipher_migrate exactly in Objective C.

PRAGMA key needs to be before PRAGMA cipher_migrate. There’s an example of it in our API documentation: SQLCipher API - Zetetic

Typically the flow is: attempt to open the database, if it fails, attempt to migrate, if that fails then the key material is incorrect.

My colleague @sjlombardo gave further details in his response here: Upgrading to SQLCipher 4 - #17 by sjlombardo

Can you please share some example.

We don’t provide publicly available examples for community edition SQLCipher users aside from the API documentation I linked above, and the standard integration examples on this page: SQLCipher Community Edition - iOS and macOS Tutorial - Zetetic

It sounds as if your organization may rely on SQLCipher. You might consider purchasing a commercial license to the software, which will include access to private, prioritized support.