kukudas
kukudas

Reputation: 4934

Saving any object to Keychain

I want to save an object which might include sensitive data into the keychain. To achieve this i will convert this object into a NSData instance.

I'm a bit confused which attributes i need to use. Is it ok to use kSecClassGenericPassword as kSecClass even though it is not really a password? Furthermore i've set the kSecAttrAccount. I've read somewhere that i also need to add kSecAttrService. What implications can happen if i don't ?

Upvotes: 5

Views: 7031

Answers (2)

user2249533
user2249533

Reputation: 29

Strongbox is using NSKeyedUnarchiver to convert any type conforms to NSCoding to NSData object before save into keychain.

Upvotes: 0

Gianluca Tranchedone
Gianluca Tranchedone

Reputation: 3598

Checkout SSKeychain on GitHub. It's a nice Open Source wrapper for the keychain that makes it super easy to use. If you want to understand more about how the keychain and the security on iOS/OS X work and you're registered to the Apple Developer Program, there are few WWDC session videos that you might check on developer.apple.com.

Upvotes: 1

Related Questions