Patrick Patterson wrote:
As Patrick wrote you can load a certificate into X509 structure, but after that you need to validate it with other facilities such as functions implemented in X509_STORE set. You can find a simple code below to load both PEM and DER certificate into a X509 structure.On November 23, 2008 10:57:55 pm ThanhTrung Do wrote:From: Itay Dagan <[EMAIL PROTECTED]> Subject: verify certificate - not from a file To: [email protected] Date: Monday, November 24, 2008, 12:37 AM Hi Guys int loadFromMemory(char *buf, int bufLen) { BIO *bp = NULL; X509 *cert = NULL; #define retFree(x) do { \ if(bp) \ BIO_free(bp); \ if(cert) \ X509_free(cert); \ return x; \ } while(0); if(!buf || bufLen < 1) return 1; bp = BIO_new(BIO_s_mem()); if(!bp) return 2; cert = X509_new(); if(!cert) retFree(3); if(!BIO_write(bp, buf, bufLen)) retFree(4); cert = PEM_read_bio_X509(bp, NULL, NULL); if(!cert) { BIO_free(bp); bp = BIO_new(BIO_s_mem()); if(!bp) retFree(5); if(!BIO_write(bp, (char *) buf, bufLen)) retFree(6); cert = d2i_X509_bio(bp, NULL); } BIO_free(bp); if(!cert) retFree(7); return 0; } Regards, Shahin Khorasani ______________________________________________________________________ OpenSSL Project http://www.openssl.org Development Mailing List [email protected] Automated List Manager [EMAIL PROTECTED] |
- verify certificate - not from a file Itay Dagan
- Re: verify certificate - not from a file ThanhTrung Do
- Re: verify certificate - not from a file Patrick Patterson
- Re: verify certificate - not from a file Itay Dagan
- Re: verify certificate - not from a file Shahin Khorasani
- Re: verify certificate - not from a file Itay Dagan
- Re: verify certificate - not from a file Itay Dagan
- Re: verify certificate - not from a file Shahin Khorasani
