I believe problem is in "PKCS12 *p12 = d2i_PKCS12_bio(in, NULL);" because some 
fields have valid data but no p12->version->data. Then, with "PKCS12_parse(p12, 
"ppppp", pkey, cert, NULL)", pkey and cert transform NULL value to correct data 
in many fields, except some as x->cert_info->version->data or 
x->cert_info->serialNumber->data. Both fields are unsigned char *.
 


From: borrash...@hotmail.com
To: openssl-users@openssl.org
Subject: Get information about PEM file
Date: Sun, 1 Mar 2009 17:44:08 +0100



Hello,
 
I'm making a client/server application with SSL certificate using Openssl 
libraries. I have generated a PEM certificate file that the server reads, 
transform to bio structure and then into PKCS12. I call the PKCS12_parse 
function to get pkey and cert structures, however some fields (X509 * x; 
x->cert_info->version->data, x->cert_info->version->serialNumber) contain 
garbage and this information is required by the client when establish 
connection through sockets.
 
My code:
 
BIO *in = BIO_new(BIO_s_file());

BIO_read_filename(in, (void*) "cacert.p12")
PKCS12 *p12 = d2i_PKCS12_bio(in, NULL);
PKCS12_parse(p12, "ppppp", pkey, cert, NULL)
 
Any suggestion?
Thanks.



Nuevo Windows Live, un mundo lleno de posibilidades Descúbrelo.
_________________________________________________________________
Chatea sin límites en Messenger con la tarifa plana de Orange
 http://serviciosmoviles.es.msn.com/messenger/orange.aspx

Reply via email to