Thank you. --satish -----Original Message----- From: owner-openssl-us...@openssl.org [mailto:owner-openssl-us...@openssl.org] On Behalf Of Brad Mitchell Sent: Tuesday, June 09, 2009 12:55 AM To: openssl-users@openssl.org Subject: RE: Certificates in a buffer
You could do this to read in a certificate: X509* loadCert(const char* inputBuffer) { BIO *cert = NULL; X509* x509Cert = NULL; cert = BIO_new_mem_buf(inputBuffer, -1); if (cert) { X509Cert = PEM_read_bio_X509(cert, NULL, 0, NULL); } If (cert) BIO_free(cert); Return x509Cert; } Loading the private key is similar, except you just call: PEM_read_bio_PrivateKey() This is what I do anyway. Brad -----Original Message----- From: owner-openssl-us...@openssl.org [mailto:owner-openssl-us...@openssl.org] On Behalf Of Satish Chandra Kilaru Sent: Tuesday, 9 June 2009 1:42 PM To: openssl-users@openssl.org Subject: Certificates in a buffer Hi All I have certificate and private key in a buffer (not in a file). How do I pass on these to OpenSSL with out storing in a temp file? In other words are there any APIs that take certificate from a buffer instead of a file? I could only find APIs that expect a file argument or X509* or ASN1 buffer? Are there any APIs that can convert PEM to ASN1? Is there a function that can take PEM buffer and return a X509 structure? I am getting certificates from a database. That is why I am looking for such APIs. --Satish ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.339 / Virus Database: 270.12.54/2157 - Release Date: 06/08/09 17:59:00 ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org ******************Legal Disclaimer*************************** "This communication may contain confidential and privileged material for the sole use of the intended recipient. Any unauthorized review, use or distribution by others is strictly prohibited. If you have received the message in error, please advise the sender by reply email and delete the message. Thank you." **************************************************************** ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org