Thank you very much!

I've used d2i_PrivateKey_bio() with the BIO I get from the key buffer.

2010/10/29 Erik Tkal <et...@juniper.net>:
> How about using the d2i_ functions?
>
>
> ....................................
> Erik Tkal
> Juniper OAC/UAC/Pulse Development
>
> -----Original Message-----
> From: owner-openssl-us...@openssl.org 
> [mailto:owner-openssl-us...@openssl.org] On Behalf Of Leandro Santiago
> Sent: Friday, October 29, 2010 7:26 AM
> To: openssl-users@openssl.org
> Subject: Re: How can I load a PEM key stored in a string instead from a file?
>
> Thanks to all. I've resolved my first problem, load the PEM from a string.
> I've used BIO_new_mem_buf() and PEM_read_bio_PrivateKey().
>
> But now I've seen that it works well with PEM keys, and now I'm trying
> to use a DER key, again from a string. Is there something like
> DER_read_bio_PrivateKey()?
>
> 2010/10/27 Dr. Stephen Henson <st...@openssl.org>:
>> On Wed, Oct 27, 2010, Leandro Santiago wrote:
>>
>>> Ok. I've found the implementation of that function:
>>>
>>> EVP_PKEY *PEM_read_PrivateKey(FILE *fp, EVP_PKEY **x, pem_password_cb
>>> *cb, void *u)
>>>       {
>>>         BIO *b;
>>>         EVP_PKEY *ret;
>>>
>>>         if ((b=BIO_new(BIO_s_file())) == NULL)
>>>               {
>>>               PEMerr(PEM_F_PEM_READ_PRIVATEKEY,ERR_R_BUF_LIB);
>>>                 return(0);
>>>               }
>>>         BIO_set_fp(b,fp,BIO_NOCLOSE);
>>>         ret=PEM_read_bio_PrivateKey(b,x,cb,u);
>>>         BIO_free(b);
>>>         return(ret);
>>>       }
>>>
>>> So if I need to implement a function which opens a char string as a
>>> key I need to write something as the code above, but changing the
>>> functions BIO_s_file() and BIO_set_fp(b,fp,BIO_NOCLOSE) to something
>>> which load from that string instead from a FILE*?
>>>
>>> ps: yes, I'm very noob on openssl. OpenSSL is amazing, but it's very
>>> hard to beginners. thx
>>>
>>
>> As others have indicated you can use PEM_read_bio_PrivateKey() instead as
>> this can be passed a BIO which is an OpenSSL I/O abstraction. You can create 
>> a
>> BIO from a character string using BIO_new_mem_buf().
>>
>> Steve.
>> --
>> Dr Stephen N. Henson. OpenSSL project core developer.
>> Commercial tech support now available see: http://www.openssl.org
>> ______________________________________________________________________
>> OpenSSL Project                                 http://www.openssl.org
>> User Support Mailing List                    openssl-us...@openssl.org
>> Automated List Manager                           majord...@openssl.org
>>
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> User Support Mailing List                    openssl-us...@openssl.org
> Automated List Manager                           majord...@openssl.org
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> User Support Mailing List                    openssl-us...@openssl.org
> Automated List Manager                           majord...@openssl.org
>
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to