4

What is the best/most secure way for my iPhone app to remember Username and Password credentials, so that the user will not have to reenter them every time they use my app? (My app will be logging in to a server using these credentials and returning some data).

Thanks!

joshim5
  • 2,292
  • 4
  • 28
  • 40

3 Answers3

7

The best place would be the keychain. It is automatically encrypted and backed up. However, on older iOS versions, the backup would not be accessible after a restore. See the Keychain Services Programming Guide and Keychain Services Reference.

ughoavgfhw
  • 39,734
  • 6
  • 101
  • 123
6

Try this SFHFKeychainUtils https://github.com/ldandersen/scifihifi-iphone/tree/master/security It's drop dead simple and works like NSUserDefaults

Mugunth
  • 14,461
  • 15
  • 66
  • 94
  • What is the benefit of using this vs. using the standard keychain like was advised by the previous answer? – joshim5 Jan 18 '11 at 18:25
  • 2
    Someone has already implemented a Keychain wrapper. If you use it, it's 2 min work to add keychain support to your app. – Mugunth Jan 20 '11 at 01:38
1

There are two ways to store user/pass.

  1. keychain api
  2. NSUserDefaults

To learn more about it,open the iOS developer library on http://developer.apple.com

Gajendra K Chauhan
  • 3,387
  • 7
  • 40
  • 55