1
$\begingroup$

I'm trying to write an encryption decryption program using Openssl-RSA. There are only two operations. User stores the data and retrieves it whenever he needs.

To decrypt something, we need the keypair that was generated during the encryption. Where and how do I store this keypair so that I can access it whenever the user requests decryption of something (which was already encrypted by the user).

$\endgroup$
1
$\begingroup$

openssl genrsa -out yourRSAkeyfile.pem

| improve this answer | |
$\endgroup$
  • $\begingroup$ Thankyou! But how do I execute this command line command using a language, (C++)? $\endgroup$ – Wasim Thabraze Dec 9 '15 at 11:09
  • $\begingroup$ Please read the source of genrsa. This is what it is available for. $\endgroup$ – Vadym Fedyukovych Dec 9 '15 at 11:24
  • 1
    $\begingroup$ @WasimThabraze, convert your key to PEM and just write it to file using your method of choice (ofstream?). $\endgroup$ – SEJPM Dec 9 '15 at 20:59
  • 2
    $\begingroup$ PEM_write_bio_RSAPrivateKey() is writing the key to the output file (well, a BIO) at line 209 of github.com/openssl/openssl/blob/master/apps/genrsa.c $\endgroup$ – Vadym Fedyukovych Dec 9 '15 at 21:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.