Reputation: 8921
When enumerating the AuthRoot
and CertificateAuthorities
X509 stores, I have been unable to find a self-signed SSL certificate that was imported into Trusted Root Certification Authorities
on the local machine:
X509Store store = new X509Store(StoreName.AuthRoot); // also tried StoreName.CertificateAuthorities
store.Open(OpenFlags.ReadOnly);
var storecollection = (X509Certificate2Collection) store.Certificates;
foreach (X509Certificate2 x509 in storecollection)
{
Console.WriteLine("certificate name: {0}", x509.Subject);
}
Are self-signed SSL certificates skipped over as invalid by the enumerator? Am I looking in the wrong place?
Here's what I see in the Certificates snap-in in MMC:
Upvotes: 4
Views: 1589
Reputation: 33098
StoreName.Root
is what you want for "Trusted Root Certification Authorities".
AuthRoot
is "Third-Party Root Certification Authorities", and CertificateAuthority
is "Intermediate Certification Authorities".
Upvotes: 6