I have X509 Signing Certificate inside of a string like:
var signingCertificate = -----BEGIN CERTIFICATE-----\r\nMIICTjCCAbegAw.........-----END CERTIFICATE-----
Now I want to read the content of this certificate. i know we can do it using X509Certificate2 object but that reads from file directly. Is there anyway to read the content from string?
You can convert your string to byte array, and create a X509Certificate2 object from it.
byte[] bytes = Encoding.ASCII.GetBytes(signingCertificate);
var x509Certificate2 = new X509Certificate2(bytes);