There appears to be some default support for sqlite encryption in iOS but I cannot find any documentation for how it works. In a fresh iOS project I created a new db and added the
key pragma before creating a table.
import SQLite3 ... sqlite3_open_v2(docStr, &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, nil) sqlite3_exec(db, "PRAGMA key = 'abc123';", nil, nil, nil) sqlite3_exec(db, "CREATE TABLE Breed (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, favorite INTEGER NOT NULL DEFAULT 0 ); INSERT INTO Breed(name) VALUES ('Beagle');", nil, nil, nil);
Checking the db on the file system it then appears to be encrypted. As I mentioned this is a clean project, I haven’t added SQLCipher or any other libs. Is there a way to know what extension/lib is using the pragma so I can know if it makes sense to use?
Running on iOS 13.2.2 on iPhone 11 simulator