I'm looking for a C# code how to decode x509 certificate from string like in this page: https://www.sslshopper.com/certificate-decoder.html
I have a certificate string, that starts with MII... and ends with == .
When I past it in https://www.sslshopper.com/certificate-decoder.html it works but I want to have my own tool like this site.
Any help?
I have a certificate string, that starts with MII... and ends with ==
it is a Base64 formatting of the ASN.1 DER encoded certificate. You can convert this string to a byte array and then construct an instance of X509Certificate2
class:
byte[] bytes = Convert.FromBase64String("MII<...>==");
var cert = new X509Certificate2(bytes);
For further reading: