SSL Identity Certificate to run an HTTPS Server on iOS

后端 未结 2 521
滥情空心
滥情空心 2020-12-17 01:10

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

2条回答
  •  清歌不尽
    2020-12-17 01:56

    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.

提交回复
热议问题