On Thu, Dec 01, 2005, Rajeshwar Singh Jenwar wrote: > extern X509 *mem2x509_pem(char *cert) > > { > X509 *x509= NULL; > BIO *bio = NULL; > int len = -1; > bio = BIO_new(BIO_s_mem()); > if (!bio) > goto end; > len = BIO_write(bio, cert, strlen(cert)); > if (len == -1) > goto end; > x509 = PEM_read_bio_X509(bio, NULL, NULL, NULL); > > if(!x509) > goto end; > end: > if(bio) BIO_free(bio); > > return x509; > } >
Its easier and more efficient to create the memory BIO with: bio = BIO_new_mem_buf(cert, -1); Steve. -- Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage OpenSSL project core developer and freelance consultant. Funding needed! Details on homepage. Homepage: http://www.drh-consultancy.demon.co.uk ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]