Clearly recognize the certificate in the Windows certificate store

I am developing a library that generates XML data and stands for generated XML. I installed the pkcs12 certificate (generated with OpenSSL from the pem file) in the Windows certificate store.

I am downloading a certificate from C # code using

X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly);
X509Certificate2 cert = null;

foreach (var item in store.Certificates)
{
    if (item.SubjectName.Name.Contains("CN=IDENTIFIER"))
    {
        cert = item;
        break;
    }
}
store.Close();

In my case, the identifier is CN: my prename + last name. The certificate comes from a third party. Therefore, I think that I do not affect identifiers.

And here is the question:

Is there any way to identify this particular certificate with C #. In the future, it is possible that several certificates have the same X509 parameters (CN, etc.).

Thanks in advance.

+3
source share
2 answers

, , CN (, -).

: 1) ( CN, RDN, ) + ( ) 2) +

, , , .

( ) MY- . .

+3

...

Certificates X509Store X509CertificateCollection.

, , Find X509FindType. . , , , DN . , ( , ).

, ( / ) , . X509FindType.

Thumbprints Windows/. Net/SSL. , HTTPS.

+3

All Articles