public void CloneTo(X509Certificate2Collection collection) { EnumCertificatesContext context = default; context.Results = new HashSet <X509Certificate2>(); bool systemOnly = _location == StoreLocation.LocalMachine; unsafe { bool success = Interop.AndroidCrypto.X509StoreEnumerateTrustedCertificates( (byte)(systemOnly ? 1 : 0), &EnumCertificatesCallback, Unsafe.AsPointer(ref context)); if (!success) { throw new CryptographicException(SR.Cryptography_X509_StoreEnumerateFailure); } } foreach (X509Certificate2 cert in context.Results) { collection.Add(cert); } }
public void CloneTo(X509Certificate2Collection collection) { EnumCertificatesContext context = default; context.Results = new HashSet <X509Certificate2>(); unsafe { bool success = Interop.AndroidCrypto.X509StoreEnumerateCertificates( _keyStoreHandle, &EnumCertificatesCallback, Unsafe.AsPointer(ref context)); if (!success) { throw new CryptographicException(SR.Cryptography_X509_StoreEnumerateFailure); } } foreach (X509Certificate2 cert in context.Results) { collection.Add(cert); } }