> From: Väinö Leppänen <narcomaco...@gmail.com> > Date: 10/21/2011 03:27 AM > > 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?
Do I understand that you have a raw public key as a byte array in a header, and you want to create the RSA structure from it? If so: RSA_new() BN_bin2bn(n) convert public modulus to bignum BN_bin2bn(e) convert exponent to bignum RSA->n = n bignum RSA->e = e bignum