>From: owner-openssl-us...@openssl.org On Behalf Of Felipe Blauth
>Sent: Friday, 29 March, 2013 16:36

>To read the key from your header file you might want to use 
>a memory BIO in conjunction with the PEM_read_bio_PUBKEY function 
>or PEM_read_bio_RSAPublicKey ( I don't remember which one you should 
>use, but this was answered in this list before). I don't have a test 

The default from commandline is PUBKEY (*private* keys changed 
from per-algorithm to PKCS8 in 1.0.0).

>enviroment right now, but you should do something like this: 

>char key[] = "Your pem key goes here";

Including newlines represented as \n, which is easy to miss.

>BIO *mem = BIO_new(BIO_s_mem()); 
>BIO_puts(mem, key); 

Or just BIO_new_mem_buf(key,len_or_neg1);

>EVP_PKEY* pkey=PEM_read_bio_PUBKEY(mem,NULL,NULL,NULL); 

Or PEM_read_bio_RSA_PUBKEY to "downcast" to RSA*, which you can 
also do separately, but EVP is generally preferable.

<snip>

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to