如何在iPhone钥匙串中添加安全标识(证书+私钥)?我在应用程序中有.p12文件.我可以使用SecPKCS12Import()从中获取身份,但是当我尝试执行以下操作时:
NSMutableDictionary *secIdentityParams = [[NSMutableDictionary alloc] init];
[secIdentityParams setObject:(id)kSecClassIdentity forKey:(id)kSecClass];
[secIdentityParams setObject:label forKey:(id)kSecAttrLabel];
[secIdentityParams setObject:(id)myIdentity forKey:(id)kSecValueRef];
status = SecItemAdd((CFDictionaryRef) secIdentityParams, NULL);
Run Code Online (Sandbox Code Playgroud)
我收到错误= -25291 - >没有可用的信任结果.我究竟做错了什么?
只需在属性字典中使用 1 个参数即可将身份添加到钥匙串:
NSMutableDictionary *secIdentityParams = [[NSMutableDictionary alloc] init];
[secIdentityParams setObject:(id)myIdentity forKey:(id)kSecValueRef];
OSStatus status = SecItemAdd((CFDictionaryRef) secIdentityParams, NULL);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8543 次 |
| 最近记录: |