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:

StoreName.Root is what you want for "Trusted Root Certification Authorities".
AuthRoot is "Third-Party Root Certification Authorities", and CertificateAuthority is "Intermediate Certification Authorities".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With