Forum Xamarin.Mac

SecKeyChain.QueryAsRecord returns wrong certificate

I'm trying to get a root certificate from keychain like this

SecRecord query = new SecRecord(SecKind.Certificate);
query.AccountName = "adfs-test-ADFSDC-CA";
var cert = SecKeyChain.QueryAsRecord(query, out SecStatusCode secStatusCode);

Unfortunately the query returns always the same wrong certificate. Even if I put in a wrong AccountName. Is there any way that I can search by SerialNumber?


  • martin_scholzmartin_scholz Member ✭✭

    I got it working by using the Label attribute in the query. Maybe someone knows a better way to do a more concrete search on attributes which are more unique.

Sign In or Register to comment.