DecodeCertKey.exe takes one or two arguments:
decodecertkey.exe <certfile | cert-store name | SubjectName substring> [M | m]
where the first argument can be:
Extracting the Public Key:
An X509Certificate object is created and X509Certificate.GetPublicKey() returns the
encoded RSA public key.
CryptEncodeObject() is P/Invoked on this RSA key to generate the X509 SubjectPublicKeyInfo (compatible
with Java and OpenSSL public key formats).
CryptDecodeObject() is then P/Invoked on the RSA public key to obtain the PUBLICKEYBLOB.
The utility manually decodes the PUBLICKEYBLOB to extract the public key parameters and extracts and
displays the public key exponent and modulus in BIG-endian byte array form. An RSACryptoServiceProvider
object is created and initialized using the modulus and exponent. The XML b64 encoded public key is
exported using RSA.ToXmlString(false) .
The user is then prompted to save the public key data to files. The output key files are named, e.g. for an input
search string "devcert1":
"X509pubkey_devcert1"
"RSApubkey_devcert1"
"PUBLICKEYBLOB_devcert1"
"XMLpubkey_devcert1.txt"
If the files already exist, no files are saved.
Download DecodeCertKey.exe v1.1.0.0 ( 27,896 bytes .NET Framework 2, Digitally Signed)
Michel I. Gallant
neutron@istar.ca