> -----Original Message-----
> From: [EMAIL PROTECTED]
> Howard Chu wrote:
> >
> > 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);
> Yes that will work. However you should also do
> BIO_set_close(bi, BIO_NOCLOSE);
> otherwise it will try to Free() the buffer when you do BIO_free(bi);
>
> Steve.
Not true - the 3rd argument to BIO_set_mem_buf already takes
care of this concern. I wouldn't have said "this works for me"
if it in fact was crashing on me, and a Free problem like you
describe would make itself known pretty quickly. (I left it out
of the above example, but I do call BIO_free(bi) immediately
after the PEM_read... Sorry for omitting that detail.)
-- Howard Chu
Chief Architect, Symas Corp. Director, Highland Sun
http://www.symas.com http://highlandsun.com/hyc
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]