I have created a public key like this:
NSString *pkFilePath = [[NSBundle mainBundle] pathForResource:@"public_key" ofType:@"der"];
NSData *myCertData = [NSData dataWithContentsOfFile:pkFilePath];
SecCertificateRef cert = SecCertificateCreateWithData (kCFAllocatorDefault, (CFDataRef)myCertData);
CFArrayRef certs = CFArrayCreate(kCFAllocatorDefault, (const void **) &cert, 1, NULL);
SecTrustRef trust;
SecPolicyRef myPolicy = SecPolicyCreateBasicX509();
SecTrustCreateWithCertificates(certs, myPolicy, &trust);
SecTrustResultType trustResult;
SecTrustEvaluate(trust, &trustResult);
SecKeyRef pub_key_leaf = SecTrustCopyPublicKey(trust);
NSLog(@"%@",pub_key_leaf);
But how to create private key from file?
Here is some related code to create a private key but I am not getting how to create private key from this using my privatekey file.
https://developer.apple.com/library/mac/#documentation/security/conceptual/CertKeyTrustProgGuide/iPhone_Tasks/iPhone_Tasks.html#//apple_ref/doc/uid/TP40001358-CH208-SW10