I use Public / Private Keys in my project to encrypt / decrypt some data.
I host the public key ("public.pem") on the server.
"public.pem" is as follows:
.....
.....
I wrote a client side that downloads this public key and saves it to disk, and then calls OpenSSL PEM_read_RSA_PUBKEY () with a file descriptor for this file. This operation works fine, and the result is an RSA object ready for encryption.
I would like to avoid writing the public key to the disk every time (since I already have a buffer in memory).
How can I perform the same operation without saving the buffer to disk? I noticed a function called: PEM_read_bio_RSAPublicKey (), but I'm not sure about its use in the BIO structure. Am I on the right track?
So the real question is: how can I read the public / private key for the RSA object directly from memory, and not from the file descriptor.
source
share