views:

226

answers:

3

Hello, the client is concerned about safety of the data application uses and stores locally on device (e.g. they want to prevent reading our data files even on jailbroken iPhones). So I wonder - what are the possible ways to ensure data safety on iPhone?

Edit: I'm thinking about 2 ways of storing data - a bunch of xml files (maximum size - about 1MB) or sqlite database. I'm more inclined to the 2nd variant but still not sure

A: 

The commoncrypto library, available on the phone, supports symmetric encryption. You can store the key in the keychain, which is itself asymmetrically encrypted. The key to decrypt the keychain is baked into the hardware so you'd need to go to some lengths to retrieve the data.

Graham Lee
Unfortunately that probably doesn't offer the sort of protection the OP is looking for. On a jailbroken iPhone you can just run gdb against the app and grab the key that is returned from the keychain.
Louis Gerbarg
On a jailbricked phone you can just acquire the plain text when it's been decrypted by whatever mechanism. However using commoncrypto at least raises the bar, by making the device backup unreadable.
Graham Lee
+1  A: 

Any time code is running on physical hardware that's out of your control, it is vulnerable - the iPhone must have the ability to decode the data for it to be usable, and if the iPhone has that ability, so does the user. If the data is valuable enough, someone will break your encryption.

The movie industry spent millions on their DVD DRM. It got cracked in a few weeks.

ceejayoz
+3  A: 

You might want to check out this article - Protecting resources in iPhone and iPad apps. It talks about a scheme to encrypt app resources at build time, which can then be decrypted when needed by your app. Decryption happens in-memory so unprotected temporary files are not left on the filesystem. You can even load encrypted HTML, PDF & images straight into a UIWebView.

Robin Summerhill