SQLCIPHER sqlite encrypted iphone ios converting un-encrypted database to encrypted database
[fmdb open];
NSString *sel = @"SELECT count(*) FROM sqlite_master";
FMResultSet *fmr = [self executeQuery : fmdb : sel];
if ( [fmr next] ) // unencrypted
{
NSLog(@"Encrypting");
fmdb.key = @"";
[fmdb rekey : @"somekey"];
}
- (BOOL)rekey:(NSString*)key {
#ifdef SQLITE_HAS_CODEC
if (!key) {
return NO;
}
int rc = sqlite3_rekey(db, [key UTF8String], (int)strlen([key UTF8String]));
if (rc != SQLITE_OK) {
NSLog(@"error on rekey: %d", rc);
NSLog(@"%@", [self lastErrorMessage]);
}
return (rc == SQLITE_OK);
#else
return NO;
#endif
}
I am trying to use 1)FMDB Pod 2)SQLCipher pod with a Rubymotion iOS project.
I am trying to encrypt the database with SQLCipher but Rubymotion does not recognize the methods offered by SQLCipher.
I have found the below mentioned piece of code which people have reported to be running in Objective C and xcode.
Can Someone please convert this to Rubymotion ?