The .NET class System.Security.Cryptography.X509Certificates.X509Extension does not support some X.509 extensions I want to parse (subject alternative name, name constraints). The MSDN page for this class states "Custom extensio开发者_如何学编程ns can be registered in a CryptoConfig file" (link), but the description of the CryptoConfig class discusses only setting up custom cryptographic algorithm implementations -- it is not obvious how to register a custom X.509 extension.
Does anyone know how to do this?
If you don't find a solution with the built-in class, take a look at our PKI components of SecureBlackbox. They let you manage custom extensions easily.
X509Certificate2 cert = new System.Security.Cryptography.X509Certificates.X509Certificate2(certByte);
string fn = cert.Extensions[0].Oid.FriendlyName;
string oid = cert.Extensions[0].Oid.Value;
string val = cert.Extensions[0].Format(true);
精彩评论