I\'m trying to build an HTTPS server in an iOS app, in order to act as a proxy between my web-app and my external server.
I have managed to make an
It looks like you need to import the identity using a PKCS #12 file. See listing 2-2 in https://developer.apple.com/library/ios/#documentation/Security/Conceptual/CertKeyTrustProgGuide/iPhone_Tasks/iPhone_Tasks.html#//apple_ref/doc/uid/TP40001358-CH208-SW13 .
I will post a separate answer, as comments are not suitable for code sharing.
Here is what I use to import my PKCS12:
CFArrayRef keyref = NULL;
OSStatus sanityChesk = SecPKCS12Import((__bridge CFDataRef)p12Data,
(__bridge CFDictionaryRef)[NSDictionary
dictionaryWithObject:password
forKey:(__bridge id)kSecImportExportPassphrase],
&keyref);
if (sanityChesk != noErr) {
NSLog(@"Error while importing pkcs12 [%d]", sanityChesk);
return nil;
}
NSArray *keystore = (__bridge_transfer NSArray *)keyref;
The complete p12 content will be in the keystore array.