MonoTouch - 如何使用 SecKeyChain.QueryAsRecord() 获取证书列表?
我通过电子邮件向我的 iPad 发送了 .p12 证书,并将其安装在下面的设置中 设置->配置文件->配置配置文件。
我尝试使用以下代码来获取 iPad 上的证书数组:
SecRecord myquery = new SecRecord(SecKind.Identity);
SecStatusCode resultCode;
SecRecord[] arrayRecords = SecKeyChain.QueryAsRecord(myquery, 10, out resultCode);
从 QueryAsRecord() 返回时,resultCode 设置为 ItemNotFound。我还尝试将 myquery 创建为:
SecRecord myquery = new SecRecord(SecKind.Certificate);
但这也导致 resultCode 设置为 ItemNotFound。
如何使用 SecKeyChain.QueryAsRecord() 获取已安装证书的列表?
I emailed my iPad a .p12 certificate and installed it in the settings under
Settings->Profiles->Configuration profiles.
I tried using the following code to get an array of the certificates on the iPad:
SecRecord myquery = new SecRecord(SecKind.Identity);
SecStatusCode resultCode;
SecRecord[] arrayRecords = SecKeyChain.QueryAsRecord(myquery, 10, out resultCode);
The resultCode is set to ItemNotFound when returning from QueryAsRecord(). I also tried creating myquery as:
SecRecord myquery = new SecRecord(SecKind.Certificate);
but that also caused resultCode to be set to ItemNotFound.
How do you use SecKeyChain.QueryAsRecord() to get a list of installed certificates?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
钥匙扣并没有你想象的那么有用。钥匙串仅允许您访问您手动添加的证书,它不会让您访问系统证书。
或者至少,我从来没有找到这样做的方法,几个月前谷歌搜索也没有找到这个问题的答案。
The keychain is not as useful as you think it is. The keychain only gives you access to the certificates that you manually added, it wont give you access to the system ones.
Or at least, I have never found a way of doing so and Googling a few months ago turned out no answers to this problem.
我强烈不同意。 monomac 与钥匙链的绑定确实做得很好并且易于使用。您可以访问登录钥匙串的所有“互联网密码”并读取/更新/删除它们。
下面是一个 github 项目的链接,它将为您提供一个开箱即用的工作示例:
https://github.com/danclarke/MonoMacKeychainDemo/blob/master/KeyChainDemo/KeychainAccess.cs
最好,
M
I strongly disagree. The monomac bindings with the KeyChain are really well done and easy to use. You can access all the "Internet Passwords" of the login keychain and read / update / delete them.
Here is a link to a github project that will give you a working example out of the box:
https://github.com/danclarke/MonoMacKeychainDemo/blob/master/KeyChainDemo/KeychainAccess.cs
Best,
M