简体   繁体   中英

How can I Get the details from Root-CA-Cert certificate (x509) chain using c#?

Let's say I have three certificates (in Base64 format)

Root
 |
 --- CA
     |
     --- Cert (client/signing/whatever)

How can I Get the data from certificate chain in C#? (All those three certs may be in my computer cert store)

How can I Get the details from Root-CA-Cert certificate (x509) chain using c#?

 How can I Get the data from certificate chain in C#? ... How can I Get the details from Root-CA-Cert certificate (x509) chain using c#? 

You can use .Net's X509Certificate Class . It has methods like GetCertHash , GetPublicKey , GetSerialNumber , GetEffectiveDateString (ie, notBefore), GetExpirationDateString (ie, notAfter ); and properties like Issuer and Subject .

For the purposes of displaying information, there is no difference between a root certificate, intermediate certificate or server certificate. A CA is just self signed (some hand waiving), which means the Issuer and Subject are the same. You can also root your trust in an intermediate, and that would not be self signed. With intermediate and server certificates, the Issuer and Subject will likely be different.

Also, this is probably a better visualization:

Root or CA
 |
 --- Intermediate
     |
     --- Server (client/signing/whatever)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM