Hello Neil,

I'm not sure I fully understand where you're stuck...

Thus wrote Neil Dugan ([email protected]):

> I need to find the public keys modulus and exponent.

> I have loaded a private/public key generated by the openssl executable  
> with the function PEM_read_bio_RSAPrivateKey() and using the function  
> PEM_write_RSA_PUBKEY() can print the private key.

> How do I find out what the modulus and exponent of the public key is?
> Preferably in hex.

On the command line, you can simply use

openssl rsa -in myKey.pem -noout -text 

and you get the hex numbers that are encoded (as ASN.1 sequence) in the
.pem file.

Private-Key: (2048 bit)
modulus:
    xx:yy:zz:aa:.....
    ...
publicExponent: 65537 (0x10001)
...

Private and public key use the same modulus.


If you need to do the same thing from your own program, the EVP_PKEY
structure has a member rsa, which in turn contains fields for n (the
modulus) and e (the public exponent).

Hope this helps,

   Martin
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [email protected]
Automated List Manager                           [email protected]

Reply via email to