2

Im new to sql cipher and tried the link of sql cipher demo application. But when I run the application,it always enters in else part of following code.

sqlite3_key(sqlite3Database, key, (int)strlen(key));
if (sqlite3_exec(sqlite3Database, (const char*) "SELECT count(*) FROM sqlite_master;", NULL, NULL, NULL) == SQLITE_OK) 
{
    NSLog(@"Password is correct, or a new database has been initialized");
} else {
    NSLog(@"Incorrect password!");
}

I already have a database say sqlDatabase.sql with me.Now I want to encrypt it but this is not working. Can anyone help regarding this?

Bindiya
  • 614
  • 2
  • 9
  • 23
Rajesh
  • 546
  • 9
  • 29
  • because it prints "Incorrect password" all the time. Can you please tell me the way to encrypt the database ? – Rajesh Oct 29 '15 at 12:03
  • It is readonly database , and Im not able to encrypt it. For that I have had use this link -> https://www.zetetic.net/sqlcipher/ios-tutorial/ – Rajesh Oct 29 '15 at 12:09
  • Update the **question** to be more complete, it will make it easier for those who want to provide an answer. Then delete the comments. – zaph Oct 29 '15 at 12:26

1 Answers1

3

If your plain-text SQLite database already exists, you will need to perform a sqlcipher_export(…); operation to encrypt it with SQLCipher. More information can be found in the documentation here.

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