views:

177

answers:

2

Is storing secret keys (internal use passwords and such) on iPhone source code and project resources (such as plist files) secure?

Obviously nothing is 100% secure, but can this information be extracted easily from an installed app?

How do you recommend storing these keys to use them in the source code?

Just in case, this question is not about storing user passwords.

+1  A: 

A lot depends on what you mean by secure. For normal device use it could be considered secure in that there is no way for a user to access it. However all bets are off for a jail-broken device which has complete access to the filesystem. So viewing a plist file in your application bundle is trivial on a jail-broken phone.

You might consider the use of the keychain which in theory would be safer and also has the advantage that the data will survive a reinstallation of your app. As before on a jail broken device nothing can be considered to be 100% secure but it depends how much trouble you want to go to.

kharrison
Using the keychain would imply storing the secret keys in the source code first, wouldn't it? Or is there are another way to initialize the keychain?
hgpc
Good point. The keychain makes most sense when the user is entering the secret key. If you want to ship the key with the application I am not sure you have any other choices. Keeping the keys in code is perhaps better than storing it in a plist file. Some simple obfuscation of the key will prevent trivial attacks but as I said before on a jail broken device if somebody wants to break your app they probably can.
kharrison
A: 

Found basically the same question with a longer discussion:

http://stackoverflow.com/questions/544463/how-would-you-keep-secret-data-secret-in-an-iphone-application

To sump up: it seems there's no official way to securely store secret keys in the app binary.

Sorry for posting a duplicate question.

hgpc