Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which X509 StoreName refers to the certificates stored beneath Trusted Root Certification Authorities in Windows10

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:

MMC Certificates snap-in

like image 324
Tim Avatar asked Sep 19 '25 00:09

Tim


1 Answers

StoreName.Root is what you want for "Trusted Root Certification Authorities".

AuthRoot is "Third-Party Root Certification Authorities", and CertificateAuthority is "Intermediate Certification Authorities".

like image 76
bartonjs Avatar answered Sep 23 '25 13:09

bartonjs