Yes, it's quite easy. This works for me in 0.9.4:
(char *buf; int len; values should already be set)
...
BIO *bi = BIO_new(BIO_s_mem());
BUF_MEM bf;
X509 *x;
bf.length = len;
bf.data = buf;
bf.max = bf.length;
BIO_set_mem_buf(bi, &bf, 0);
x = PEM_read_bio_X509(bi, NULL, NULL, NULL);

  -- Howard Chu
  Chief Architect, Symas Corp.       Director, Highland Sun
  http://www.symas.com               http://highlandsun.com/hyc

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of hazel Gao
> Sent: Wednesday, April 05, 2000 8:16 PM
> To: [EMAIL PROTECTED]
> Subject: Re: the API to load X509 from char*
> 
> 
> I'm using openssl-0.9.4 at present. Are any similiar
> APIs in openssl-0.9.4, or do I have to upgrade to
> openssl-0.9.5?
> 
> Hazel
> > They aren't for files they are for fps and BIOs
> > which aren't necessarily
> > files. BIOs in particular can point to all manner of
> > things including a
> > memory buffer. For example in OpenSSL 0.9.5 and
> > later you can call:
> > 
> > bio = BIO_new_mem_buf(buffer, length);
> > 
> > and then call PEM_read_bio_X509() on it.
> > 
> > Steve.
> > -- 
> 
> __________________________________________________
> Do You Yahoo!?
> Talk to your friends online with Yahoo! Messenger.
> http://im.yahoo.com
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> Development Mailing List                       [EMAIL PROTECTED]
> Automated List Manager                           [EMAIL PROTECTED]
> 
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to