IPhone app with SSL client certs

后端 未结 7 696
逝去的感伤
逝去的感伤 2021-01-30 09:53

I\'m building an iphone app that needs to access a web service over https using client certificates. If I put the client cert (in pkcs12 format) in the app bundle, I\'m able to

7条回答
  •  失恋的感觉
    2021-01-30 10:21

    I've tried with this:

    NSString *thePath = [[NSBundle mainBundle] pathForResource:@"certificate" ofType:@"p12"]; 
    NSData *PKCS12Data = [[NSData alloc] initWithContentsOfFile:thePath]; 
    CFDataRef inPKCS12Data = (CFDataRef)PKCS12Data; 
    CFStringRef password = CFSTR("pass"); 
    const void *keys[] = { kSecImportExportPassphrase }; 
    const void *values[] = { password }; 
    CFDictionaryRef optionsDictionary = CFDictionaryCreate(NULL, keys, values, 1, NULL, NULL); 
    CFArrayRef items = CFArrayCreate(NULL, 0, 0, NULL); 
    SecPKCS12Import(inPKCS12Data, optionsDictionary, &items); 
    

    inPKCS12Data is correct but items is empty. What is happening?

提交回复
热议问题