encryption - iPhone: How to create a SecKeyRef from a public key file (PEM) -
To send and receive encrypted messages from the iPhone, please file a public key (public key of the server) and a second Make Carefiff (I could later put it on a keychain to make it again).
This is my current workflow:
- On the server: Create a P12 file with the user's certificate and private key Store the user's public key on the server's keychain.
- On the iPhone: Recover the P12 file from the server, open the password and store the private key on the keychain.
- On iPhone: Recover a PEM file with the server's public key from the server Create a SecureFrance and place it on a bunch of keys
- On iPhones: Encrypted messages from / from the server Use both keys to send / receive.
- Live with happiness ever.
I'm having problems with 3 because I can not make the sec file with the PEM file data. I can not find any documentation on how to do this, would anyone have the same problem was? Any sign? As I do not find any code examples or documentation on it, it seems that I am doing something wrong ...
Thank you!
You can explain the DER encoded spam and by using SecCertificateCreateWithData ()
You should be able to get the proof from which you can remove a key;
NSDTa * myCertData = ....; SecCertificateRef cert = SecCertificateCreativeWithData (KCFLoketer Default, myCertData); CFArrayRef certs = CFArrayCreate (kCFAllocatorDefault, (denoted zero **) and certificate, 1, zero); SecTrustRef Trust; SecTrustCreateWithCertificates (certs, policy, and trust); SecTrustResultTypeType TrustResult; SecTrustEvaluate (Trust, and Trust Result); SecKeyRef pub_key_leaf = SecTrustCopyPublicKey (Trust);
Comments
Post a Comment