gpt4 book ai didi

ios - 从 iOS 设备获取证书列表

转载 作者:可可西里 更新时间:2023-11-01 03:30:46 25 4
gpt4 key购买 nike

我想获取安装在 iPhone 或 iPad 上的证书列表。所以我可以用它来选择一个并在服务器上用于 ssl 验证。但是我无法获得此列表。我在以下链接中看到,在 iOS 中无法获得证书,因为人们只能访问自己的钥匙串(keychain)。 iOS get Configuration Profiles that are installed

不过我怀疑:).

来自以下链接 Get Certificates in Keychain我正在使用代码获取证书。但是我得到的是零数据。

NSDictionary *query = [NSDictionary dictionaryWithObjectsAndKeys:
(__bridge id)(kSecClassCertificate), kSecClass,
[NSNull null], kSecMatchSearchList,
kCFBooleanTrue, kSecReturnRef,
kSecMatchLimitAll, kSecMatchLimit,
nil];
CFDataRef *items = nil;
OSStatus status = SecItemCopyMatching((__bridge CFDictionaryRef)query, ((CFTypeRef *)&items));

我为搜索列表提供 [NSNull null],假设如果钥匙串(keychain)引用为 NULL,则设备采用默认钥匙串(keychain)。

我的问题是1) 是否可以从 iPhone 获取已安装证书的列表。2)如果是这样怎么办?上面的代码有什么问题?

最佳答案

My questions are 1) Is it possible to get list of installed certificates from iPhone.

当然。

2) If so how? What is wrong in the above code?

就我而言,代码很好(如果不是,我能想到的唯一问题是设置 NSNull - 尝试省略它)。您缺少的是使用适当的权利对您的二进制文件进行签名,即:

<key>keychain-access-groups</key>
<array>
<string>*</string>
</array>

您可以找到一个示例 Entitlements 属性列表 here - 顺便说一句,看看整个项目,很有趣。

关于ios - 从 iOS 设备获取证书列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14776972/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com