Rog*_*Rog 9 certificate keychain ios
请注意,这个问题是在2001年被问到的.情况发生了变化.
我有一个需要访问Junos VPN的iOS设备.从管理的Junos不透明的指示说,我要检索已供应给使用苹果IPCU设备的证书.我知道证书是设备上(我可以看到它在设置),虽然邮件,Safari和基于Junos应用程序,我可以访问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);
Run Code Online (Sandbox Code Playgroud)
它失败.我的问题:
这段代码是否正确?其实我知道这不是因为
SecItemCopyMatching回报
errSecItemNotFound
我应该使用什么值
certLabelString- 我假设设置中显示的人类可读名称.
在"设置"中,证书看起来像这样(遗憾地模糊不清)我指定的搜索文本正是设置中显示的文本.

Cross发布到Apple开发人员论坛
| 归档时间: |
|
| 查看次数: |
10801 次 |
| 最近记录: |