Im iOS developer , I have encrypted the database and checked the hex dump.It works fine. I want to Know how to read data from encrypted database.I have used below code but overtime i get Incorrect password

-(void)readDataBase{

NSString *databasePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]stringByAppendingPathComponent: @“encrypted.db”];
NSLog(@“the DataBasePath is ::%@”,databasePath);

sqlite3 *db;
if (sqlite3_open([databasePath UTF8String], &db) == SQLITE_OK) {
    
    const char* key = [@"test123" UTF8String];
    char *error = nil;
   
      sqlite3_key(db, key, (int)strlen(key));
    
    if (sqlite3_exec(db,"SELECT count(*) FROM sqlite_master;", NULL, NULL, &error) == SQLITE_OK) {
        // password is correct, or, database has been initialized
        NSLog(@"correct password");
    } else {
        // incorrect password!
        NSLog(@"incorrect password");
        NSLog(@"%s",error);

    }
           sqlite3_close(db);
}

}

Hello @Deepak

Is there a specific situation that arises where the query to sqlite_master fails following a sqlite3_key operation? We would be glad to look into a reproducible error.