SQLite Encryption on iOS 15.2

I develop an app that uses the version of SQLite that ships with iOS. I believe the system version of SQLite includes the commercial SEE (SQLite Encryption Extension) and I have been using this with a 'PRAGMA key=***' statement to successfully read/write encrypted databases for some time on iOS 14.5 and below. I have also had success on an iOS 15.0 simulator.

However, on iOS 15.2 I am unable to read/write encrypted databases using this method. The PRAGMA key statement should return the string 'ok' in most circumstances but on iOS 15.2 it returns null (as do other PRAGMA's like textkey and hexkey). This makes me think that SEE is not included on iOS 15.2 and only the public domain SQLite is available.

Does anybody know if this is actually the case?

Executing 'select sqlite_version()' on iOS 15.2 reports the version as 3.36.0.

We have the same issue. In our case, when iOS is upgraded from 15.1 to 15.2 and executed the api sqlite3_key by sqlCipher, the api will return error code 21. If the app is removed and reinstalled in iOS 15.2, then the sqlite can be accessed normally. We guess whether the decryption implementation of the operating system has changed?

Reinstalling makes sense. The behaviour of the sqlite3_key API is to fall back gracefully to plain text databases if the sqlite implementation does not support encrypted databases. This explains why iOS 15.2 can't open an encrypted database. By removing the app you are deleting your encrypted database and by reinstalling the app iOS 15.2 is creating a plain text database. You can confirm by extracting the iOS 15.2 database file and opening it in a text editor.

It would be nice to get a definitive answer on what version/flavour/encryption methods of SQLite are supported on different iOS versions.

hi there, i am also facing this issue, did you happen to find any solution? on upgrade of ios 15.x users are unable to access the contents read from the sql database. reinstalling resolves the issue

Any idea around, which SEE flavour/algorithm does iOS come with by default. Is there a way to check this? In my case, the idea is to use one of the following flavours sqlite3-see-aes256-openssl.c sqlite3-see-aes256-cryptoapi.c

SQLite Encryption on iOS 15.2
 
 
Q