by Aryana [s_ghanipour at yahoo dot com] posted on 2004/06/27
Hi,
I want to extract public key from a X509 DER encoded certificate but i don't know the format of storing public key in the certificate. What i need to know is the order of storing modulus and public exponent and key length in the public key field of a DER encoded certificate.
Any point is appreciated.
Aryana
by Pieter Philippaerts [Pieter at mentalis dot org] posted on 2004/06/29
Here's how you can do it with the security library:
- first load the certificate
Certificate c = Certificate.CreateFromCerFile("...");
- then get an RSA instance that represents the public key
RSA pub = c.PublicKey;
- finally, export the public key modulus and exponent
RSAParameters rsap = pub.ExportParameters(false);