简体   繁体   中英

Programmatic way to tell if Certificate is a Personal or Root Certificate

If I have a certificate (X509Certificate2 object) in C#, is there a way to determine whether the certificate is a personal or root certificate?

When you install a certificate in Windows, it tries to automatically determine what store to place the cert in. Is there a way to determine this using the cert's data, or to install the cert and let .NET determine which store it should be installed?

You need to use the the X509BasicConstraintsExtension.CertificateAuthority property to identify if a certificate is a certificate authority(not necessarily root, it can also be intermediate). See more info and an example in official documentation .

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