Extracting public key from private key in OpenSSL

Posted by ereOn on Stack Overflow See other posts from Stack Overflow or by ereOn
Published on 2010-04-10T14:27:59Z Indexed on 2010/04/10 14:33 UTC
Read the original article Hit count: 233

Filed under:
|
|
|

Hello,

I need to extract the RSA public key from a RSA private key using OpenSSL.

I'm currently using RSAPublicKey_dup() passing the RSA* private key to get the public key. However, while the call seems to work, I cannot load (or use) this public key using the openssl command-line tool.

If I generate the public key using the command-line tool ("$ openssl rsa -in private.pem -pubout > public.pem"), I can use it and it works like a charm.

Do you guys know how I can get this work ? Maybe another function ? The OpenSSL documentation is quite hard to browse...

Thank you.

© Stack Overflow or respective owner

Related posts about c

    Related posts about c++