Use BIO_read_bio_RSA_PUBKEY() with BIO_new_mem_buf()
to read directly from memory.

For even more efficient code, use the openssl rsa command
at build time to convert the PEM file to DER format before
embedding it in your code, then simply pass that data to
d2i_RSA_PUBKEY directly.  This will make the embedded
data 25% smaller by skipping the Base64 encoding.

On 10/21/2011 9:23 AM, Väinö Leppänen wrote:
Hello,

I'm just starting with openssl and public key encryption.
I'm trying to encrypt certain knowledge in a C++ application,
and I already have a working code but functions such as
    PEM_read_RSA_PUBKEY
read the public key data from a file. The natural workaround
of course is to implant the public key in a header and write
it to a temporary file at runtime and then load it to the RSA-
structure.

Is there a way to load the header data directly to the RSA-
structure?

All help is appreciated.
Cheers

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [email protected]
Automated List Manager                           [email protected]

Reply via email to