在iOS上查找证书

请注意,这个问题是在2001年被问到的。情况发生了变化。 我有一个需要访问Junos VPN的iOS设备。来自Junos管理员的不透明指令说我必须检索已使用Apple IPCU配置到设备的证书。我知道证书在设备上(我可以在设置中看到它),我可以通过Mail,Safari和Junos App访问VPN。 Apple文档声明每个应用程序都有自己的钥匙串,但这三个应用程序都可以看到证书。 Jusos可以访问IPCU提供的证书,这意味着任何应用都可以访问此证书。但是,当我尝试找到它时:
    CFTypeRef   certificateRef = NULL;                                                  // will hold a ref to the cert we're trying to retrieve
const char *certLabelString = "myCertificateName";                                      // c string of the certificate we're searching for.
CFStringRef certLabel = CFStringCreateWithCString( NULL, certLabelString, kCFStringEncodingUTF8); // the search we need - a string match for a UTF8 String.

const void *keys[] =   { kSecClass, kSecAttrLabel, kSecReturnRef };
const void *values[] = { kSecClassCertificate, certLabel, kCFBooleanTrue };
CFDictionaryRef dict = CFDictionaryCreate(NULL, keys, values, 3, NULL, NULL);       // set up a search to retrieve this certificate.
OSStatus status = SecItemCopyMatching(dict, &certificateRef);                               // Search the keychain, returning in dict

if(status != errSecSuccess)
    NSLog(@"keychain find returned %ld", status);

if(dict)
    CFRelease(dict);
它失败。我的问题: 这段代码是否正确?其实我知道 这不是因为
SecItemCopyMatching
返回
errSecItemNotFound
我应该使用什么价值
certLabelString
- 我假设了 人类可读的名字显示在 设置。 在“设置”中,证书看起来像这样(遗憾地模糊不清)我指定的搜索文本正是设置中显示的文本。 Cross发布到Apple开发人员论坛     
已邀请:
所以答案(在Apple论坛上)是mail.app和Safari.app共享Apple钥匙串标识符,这是唯一可以使用Apple MDM工具推送证书的钥匙串。任何反对这一点的人都应该提出缺陷,以鼓励Apple做正确的事。     
从2015年中期开始,现在有
Safari Services framework
(next5ѭ和ѭ6next,我们现在有
SFSafariViewController
)。
SFSafariViewController
有能力访问苹果钥匙串,因此可以使用所有身份:)非常好。 https://developer.apple.com/videos/play/wwdc2015/504/ https://developer.apple.com/library/ios/documentation/SafariServices/Reference/SafariServicesFramework_Ref/index.html#//apple_ref/doc/uid/TP40016218     

要回复问题请先登录注册