[openssl-users] Generating RSA PrivateKey and PublicKey programmaticallly

Nayna Jain naynjain at in.ibm.com
Tue Apr 28 21:10:50 UTC 2015

Is there any other way to store private key and public key rather than in
PEM format in file ?

I mean API to store public and private key separately in memory.

Thanks & Regards,
Nayna Jain

From:	Matt Caswell <matt at openssl.org>
To:	openssl-users at openssl.org
Date:	04/28/2015 08:29 PM
Subject:	Re: [openssl-users] Generating RSA PrivateKey and PublicKey
Sent by:	"openssl-users" <openssl-users-bounces at openssl.org>

On 28/04/15 15:39, Nayna Jain wrote:
> Hi all,
> I want to generate public and private key pair programmatically.
> However, I have some basic questions.
> The key generated using RSA_generate_key_ex  is actually a key pair ,
> having both private and public key.
> NOw, if I want to extract the public and private keys separately from
> this and want to store it in different privatekey.pem and publickey.pem
> file, how can I do that programmatically.
> Also, when openssl genrsa commandline generates the privatekey.pem, does
> it has only private key or also publickey

Take a look at the various PEM_write*PUBKEY() and PEM_write*PrivateKey()
functions here:



openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150429/2060f7e2/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20150429/2060f7e2/attachment-0001.gif>

More information about the openssl-users mailing list