'Mac Catalyst net maui KeyChain

I'm trying to access the keychain to get the installed certificates, but it always returns null.

I installed the pfx certificate on my macOS, but in the code output it says "item not found".

SecRecord rec = new(SecKind.Certificate);
 SecStatusCode code;
 SecKeyChain.QueryAsRecord(rec, out code);
 NSData[] nsDatas = SecKeyChain.QueryAsData(rec, false, 999, out code);
 if (nsDatas != null)
 {
     foreach (NSData item in nsDatas)
     {
         X509Certificate2 cert = new X509Certificate2(item.ToArray());
         x509Certificate2s.Add(cert);
     }
 }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source