Is there a way to extract the public key from a certificate using C#? I have a certificate file with .crt extension.
Use:
certificate = new X509Certificate2("server.crt", "secret_password");
byte[] publicKey = certificate.PublicKey.EncodedKeyValue.RawData;
now the 'publicKey' byte array is the ASN.1-encoded representation of the public key value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With