Skip to main content

Posts

Showing posts with the label sqlite3

SQLCipher Working But Incorrect Password

I've just implemented SQLCipher in my app to encrypt one fairly simple database. I followed all of the setup instructions carefully on this tutorial and the project is building and the app is running successfully. However, when I use their sample code to encrypt my database, my password is somehow incorrect and I am now unable to open my database. Here is the code: NSString *path = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent: @"dict.sqlite"]; if (sqlite3_open([path UTF8String], &database) == SQLITE_OK) { const char* key = [@"BIGSecret" UTF8String]; sqlite3_key(database, key, strlen(key)); if (sqlite3_exec(database, (const char*) "SELECT count(*) FROM sqlite_master;", NULL, NULL, NULL) == SQLITE_OK) { // password is correct, or, database has been initialized NSLog(@"Correct Password :)&qu