iphone - SqlCipher does not encrypt -


i dont compile errors, database not encrypt...

const char* key = [@"bigsecret" utf8string];     int err = sqlite3_key(database, key, strlen(key));      if (sqlite3_exec(database, (const char*) "select count(*) animals;", null, null, null) == sqlite_ok) {         // database has been initialized     } 

i referring site http://sqlcipher.net/documentation/ios , using sqlitetutorial example has animaldatabase.sql database in it.

i came know encryption wont work on existing database, tried below code:

      - (void)encryptdb     {         nslog (@"start");         sqlite3 *db = [self getnewdbconnection];          sqlite3_exec(db, "attach database animaldatabase.sql encrypted key 1234;", null, null,  null);      sqlite3_exec(db, "create table encrypted.account(id,name,desc,image);", null, null, null);     sqlite3_exec(db, "insert encrypted.account select * animals;", null, null, null);      sqlite3_exec(db, "detach database encrypted;", null, null, null);        nslog (@"end");     }      - (sqlite3 *)getnewdbconnection{         if (sqlite3_open([databasepath utf8string], &newdbconnection) == sqlite_ok) { // opening animaldatabase.sql          nslog(@"database opened :)");     } else {         nslog(@"error in opening database :(");     }      return newdbconnection;  }  

but still no success. can help?

the problem aren't linking project against sqlcipher static library. thus, project using default system sqlite framework.

go project build settings -> build phases -> link binary libraries , make sure libsqlcipher.a , libcrypto.a both listed there. if not, add them. clean project , rebuild.


Comments