I can create a public-private keypair using SecKeyGeneratePair [Apple CryptoExercise] .
Q1. The keys in the keychain are displayed so that they do not display any name. How to add a friendly name to keys. 
Q2. However, how can I export the public and private keys that were generated in a usable format:
-----BEGIN RSA PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqCWtYiGnhAv... -----END RSA PUBLIC KEY-----
and
-----BEGIN PRIVATE KEY----- -----END PRIVATE KEY-----
Please note that they can be manually exported from the keychain, but how can this be achieved using Object Apis C.
Any help would be noticeable.
There is a similar question here, but without an answer: iPhone: how do you export SecKeyRef or NSData containing the public key in PEM format? There is no need to use OpenSSL for this purpose.
objective-c keychain public-key-encryption private-key
Abhinav
source share