I want to add certain CA certificates for TLS validation to the keychain of my iOS 6 application. The certificates are included in the Application Bundle. I do not
I'd say that's a bug, see related question SSL Identity Certificate to run an HTTPS Server on iOS and bug SecPKCS12Import returns empty array when certificate expires after Jan 1st 10000.
As you only want a certificate, without the private key, I'd import the certificate from a DER format file.
$ openssl x509 -in google.pem -out google.der -outform DER
$ openssl x509 -in google.der -noout -text
Bundle DER certificate file and import it:
NSString *path = [[NSBundle mainBundle] pathForResource:@"google" ofType:@"der"];
NSData *derData = [NSData dataWithContentsOfFile:path];
SecCertificateRef cert = SecCertificateCreateWithData(NULL, (CFDataRef)derData);
// add cert to KeyChain or use it as you need
CFRelease(cert);