How to store keypair generated by RSA in a textfile? 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).
openssl genrsa -out yourRSAkeyfile.pem