Using latest version of SQL Cipher, the decryption of an encrypted database is not working
Note that database object is a sqllite3.db encrypted and working (selects work).
int rc = 0;
NSString *unEncryptDB = [path stringByAppendingPathComponent:@“plaintext.db”];
const char * sqlQ = [[NSString stringWithFormat:@“ATTACH DATABASE ‘%@’ AS plaintext KEY ‘’;”, unEncryptDB] UTF8String];
// Attach empty encrypted database to unencrypted database
rc = sqlite3_exec(database, sqlQ, NULL , NULL , NULL );
sqlite3_errmsg(database);
RC returns 21, and error message is out of memory
// export database
rc = sqlite3_exec(database, “SELECT sqlcipher_export(‘plaintext’);”, NULL , NULL , NULL ); //gives error
sqlite3_errmsg(database);
// Detach encrypted database
rc = sqlite3_exec(database, “DETACH DATABASE plaintext;”, NULL , NULL , NULL );
sqlite3_errmsg(database);
Below code failed to un-encript database