Hi I am trying to create, store and later retrieve private and public key pair in iPhone. And also create CSR. How can I store it in keychain and later refer to the same key to load?
You could modify the KeyChainItemWrapper so it handles Keys instead of passwords. Replace kSecClassGenericPassword in the code with kSecClassKey. Be aware, that the number of attributes supprted by keys is different from the ones supported by passwords. So you cannot use kSecAttrGeneric to store the key identifier. You might use kSecAttrApplicationLabel. An overview of supported attribute types per keychain item class can be found here: http://developer.apple.com/iphone/library/documentation/Security/Reference/keychainservices/Reference/reference.html
Thank you! I had been searching the internet and read the Apple documentation. I was pretty unclear about the whole thing. Your article helped a lot! Thanks!
Hi
ReplyDeleteI am trying to create, store and later retrieve private and public key pair in iPhone. And also create CSR. How can I store it in keychain and later refer to the same key to load?
You could modify the KeyChainItemWrapper so it handles Keys instead of passwords. Replace kSecClassGenericPassword in the code with kSecClassKey. Be aware, that the number of attributes supprted by keys is different from the ones supported by passwords. So you cannot use kSecAttrGeneric to store the key identifier. You might use kSecAttrApplicationLabel. An overview of supported attribute types per keychain item class can be found here: http://developer.apple.com/iphone/library/documentation/Security/Reference/keychainservices/Reference/reference.html
ReplyDeleteHi,
ReplyDeleteI am trying to add RSA public key to key chain.But am getting an error while adding
"errSecInteractionNotAllowed"..
How can I get rid of this error??
Regards,
Syam
This is great info!
ReplyDeleteThanks a lot for this!
-Ken
Thank you! I had been searching the internet and read the Apple documentation. I was pretty unclear about the whole thing. Your article helped a lot! Thanks!
ReplyDelete