On Thu, Jul 10, 2008, Christopher Ivory wrote:
Hello all,
I'm trying to run a loop to parse the same p12 multple times to take some
metrics. However, after the loop completes twice succesfully, PKCS12_parse
fails. Any suggestions as to why this is happening?
-Chris
while(count 0){
/* Parse the PKCS #12 file with password */
ca = (STACK_OF(X509) *)NULL;
if (!PKCS12_parse(p12, password, pkey, cert, ca))
{
printf(Error parsing file\n);
return -3;
}
/* Find PKey */
if ( (EVP_PKEY *)NULL == pkey ){
//printf(No private key!\n);
}
else{
//printf(Private key found!\n);
}
/* Find Cert */
if ( (X509 *)NULL == cert ){
//printf(No X509!\n);
}
else{
//printf(X509 found!\n);
}
/* Find CA */
if ( (STACK_OF(X509) *)NULL == ca ){
//printf(No CA!\n);
}
else{
//printf(CA found!\n);
}
count--;
EVP_PKEY_free(pkey);
X509_free(cert);
sk_X509_pop_free(ca, X509_free);
}//end while
Try the FAQ for details of how to get a more meaningful error code.
Steve.
--
Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
OpenSSL project core developer and freelance consultant.
Homepage: http://www.drh-consultancy.demon.co.uk
__
OpenSSL Project http://www.openssl.org
User Support Mailing Listopenssl-users@openssl.org
Automated List Manager [EMAIL PROTECTED]