3

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.

hpique
  • 119,096
  • 131
  • 338
  • 476

2 Answers2

2

Found basically the same question with a longer discussion:

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.

Community
  • 1
  • 1
hpique
  • 119,096
  • 131
  • 338
  • 476
1

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
  • 3,412
  • 1
  • 24
  • 19
  • 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? – hpique Apr 04 '10 at 22:42
  • 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 Apr 05 '10 at 11:12
  • This is about bundling a secret key with the app. This will never be secure. But, to your point, about storing secrets(generated on runtime or received from server side) in the device the ios now has the "Secure Enclave" and the Android has the "Trust Zone" which are tamper proof coprocessors (a TEE- trusted execution environment) that is outside reach even for jailbroken devices. – Radu Simionescu Nov 22 '17 at 08:48