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 b开发者_如何学Goe set to ItemNotFound.
How do you use SecKeyChain.QueryAsRecord() to get a list of installed certificates?
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.
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
精彩评论