0

here is my code to create a new encrypted database

sqlite3 *db;

if (sqlite3_open([databasePath UTF8String], &db) == SQLITE_OK) {
    const char* key = "sssri";    //the key to encrypt the database
    sqlite3_key(db, key, strlen(key));    //using the SQLCipher to encrypt database
    if (sqlite3_exec(db, (const char*) "SELECT count(*) FROM sqlite_master;", NULL, NULL, NULL) == SQLITE_OK) {
        NSLog(@"password is correct, or, database has been initialized");  //this step is also successful
        if(sqlite3_exec(db, (const char*)"create Table student (name char(4) primary key,class varchar(50) not null)", NULL, NULL, NULL)== SQLITE_OK)
        {
            NSLog(@"create a table")    //create a table if not the database is empty,and create successfully
            ;            }

    } else {
        NSLog(@"incorrect password!");
  }

    sqlite3_close(db);

but when i try to open the sqlite database in my app documents using the SqliteManger tool ,i input the "sssri" key ,the database can't be opened correctly.

Why?Some help will be appreciated!

chenakira
  • 131
  • 1
  • 10

2 Answers2

2

The SQLite Manager tool does not support SQLCipher. If you would like to interact with a SQLCipher database, outside of your codebase, consider using the SQLCipher command line shell.

Nick Parker
  • 1,378
  • 1
  • 7
  • 10
0

Try using version 4.3.0 (or later): http://www.sqlabs.com/news/sqlitemanager/

Mark
  • 7,446
  • 5
  • 55
  • 75