In order to send and receive encrypted messages from/to the iPhone I need to read a public key (server\'s public key) PEM file and create a SecKeyRef (later I could even sto
You should be able to interpret a DER encoded pem and get a cert using SecCertificateCreateWithData()
from which you can then extract a key;
NSData *myCertData = ....;
SecCertificateRef cert = SecCertificateCreateWithData (kCFAllocatorDefault, myCertData);
CFArrayRef certs = CFArrayCreate(kCFAllocatorDefault, (const void **) &cert, 1, NULL);
SecTrustRef trust;
SecTrustCreateWithCertificates(certs, policy, &trust);
SecTrustResultType trustResult;
SecTrustEvaluate(trust, &trustResult);
SecKeyRef pub_key_leaf = SecTrustCopyPublicKey(trust);