Hi All,
I'm trying to use SQLCipher with FMDB. Anyone has an idea, or a tutorial with the whole process ?
Thanks a lot !
--
You received this message because you are subscribed to a topic in the Google Groups "FMDB" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/fmdb/d7EFu9-RWuE/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to fmdb+uns...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
DB Error: 26 "file is encrypted or is not a database"
Should I use "setKey" only at creation time ? Does my database first need to be crypted with another tool ?
When i try to insert a row, first I use setKey, then I open the database.
If i first open the database before setKey, no datas are crypted. The otherway, i get the error "DB Error: 26 "file is encrypted or is not a database"
Can you please help me ?
Thanks a lot !
Arnaud
if([[NSFileManager defaultManager] fileExistsAtPath:self.databasePath])
return;
NSString *databasePathFromApp = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:self.databaseName];
[[NSFileManager defaultManager] createFileAtPath:self.databasePath contents:[NSData dataWithContentsOfFile:databasePathFromApp] attributes:nil];
After this step, i have my sqlite file in the App's documents folder. I can open this file, it's not encrypted.
Then, i make :
self.db = [FMDatabase databaseWithPath:self.databasePath];
[self.db setKey:secretKEY];
[[DB sharedInstance] encryptDB]; //setKey()
[[[DB sharedInstance] db] open];
BOOL inserted = [[[DB sharedInstance] db] executeUpdate:sql withParameterDictionary:datas];
[[[DB sharedInstance] db] close];
Whatever I do, i always get the error. I'll explain you my whole process, please correct me when I'm wrong :In my xCode project, I have an empty sqlite file, with empty tables. This file is not encrypted at all.When the app launches, i check if the database is copied in the Documents folder. If not, i copy it using this code :
[self.db rekey:secretKEY];
(secretKey is a NSString object)
but i get this error :
2013-04-12 22:17:54.770 App[11827:c07] error on rekey: 1
2013-04-12 22:17:54.771 App[11827:c07] out of memory
Any ideas ?
--
You received this message because you are subscribed to the Google Groups "FMDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fmdb+uns...@googlegroups.com.
In fact, I was not opening before rekey()Now that i open the database before rekey, i have no more error.But the database file is not encrypted...
/* sqlite3_rekey** Given a database, this will reencrypt the database using a new key.** There is only one possible modes of operation - to encrypt a database** that is already encrpyted. If the database is not already encrypted** this should do nothing** The proposed logic for this function follows:** 1. Determine if the database is already encryptped** 2. If there is NOT already a key present do nothing** 3. If there is a key present, re-encrypt the database with the new key*/
--
You received this message because you are subscribed to a topic in the Google Groups "FMDB" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/fmdb/d7EFu9-RWuE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to fmdb+uns...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.