Reputation: 1059
I have created an application in which I have fetched personal information from the website and stored in my sqlite3 local database.The authenticate user only see their information after successful logIN. Then I am displaying it as required. I do not want these information to be hacked by anyone when the phone is lost.
I have implemented the feature that when the app comes to foreground from the background it will ask for the pin which is hardcoded in the app.
My questions:
Can any one access my sqlite3 local database when the phone is lost ?
Is there any way to encrypt the database and decrypt it when required ?
How I will be sure that the database is not vulnerable .
Thanking you
Upvotes: 3
Views: 576
Reputation: 1293
Try this..
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *dbPath = [documentsDirectory stringByAppendingPathComponent:@"myDatadase.sqlite"];
if (sqlite3_open_v2([dbPath UTF8String], &database, SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE|SQLITE_OPEN_FILEPROTECTION_COMPLETEUNTILFIRSTUSERAUTHENTICATION, NULL) == SQLITE_OK){
NSLog(@"db opened securely");
}else{
NSLog(@"db not opened");
}
Upvotes: 1
Reputation: 8808
As others have stated, yes, your information may well be accessible.
If your database contains confidential information it should be, at a minimum, stored using the iOS Secure File Storage mechanisms (assuming the OS supports it... IIRC it's iOS 4+).
For sqlite, to your sqlite3_open_v2() call pass one of the rather unwieldy
SQLITE_OPEN_FILEPROTECTION_COMPLETE...
options to enable secure file storage. These constants are declared with the rest of them in sqlite3.h.
Upvotes: 0
Reputation: 1
Is this your problem to solve? It could be best to educate the user to use the Find My iPhone app to remotely wipe their lost iPhone. Savvy users will do this automatically to protect their contacts, and saved passwords to PayPay, eBay etc.
Upvotes: 0
Reputation: 9698
Anyone can access your file if they can get the phone (which is not so hard e.g. using iPhone Explorer)
I googled and found http://sqlcipher.net/. Take a look.
If you are encrypting your database using user-supplied password, so I think it is secured enough in your part. The vulnerable might exist in encryption part or so, but we can never be sure.
Upvotes: 0