Hello everybody,
I have a problem using PKCS12_parse that returns 0, meaning something
goes wrong. I am using MS VisualC++ 6.0 on a Windows2000 (Intel)
machine. I'm writing a simple application just to understand some the
libeay library calls, but I can't figure out what's wrong with my code.
I have a valid PKCS12 file, I know it's valid because "openssl pkcs12 -
in <filename>" parses it correctly without errors (so I'm sure my
passphrase is correct too).
Well, before bothering this maling list I run the visual debugger just
to figure out what's wrong by myself, and so I went trought various
library calls, from PKCS12_parse to PKCS12_verify_mac and
PKCS12_gen_mac, each of which returning 0. Finally I reached what
appears as an end point, when PKCS12_gen_mac calls EVP_get_digestbyobj,
that doesn't return a valid digest (in may opinion at least), that's
0x00000000.
Since I'm too beginner to really understand all that code, is there
someone so kind to explain me what and where I'm doing wrong?
Here is my simple code:
void CImportP12Dlg::OnButtonConverti()
{
PKCS12 *p12;
EVP_PKEY *privkey;
X509 *cert;
STACK_OF(X509) *ca=NULL;
int ret,len;
BIO *in;
const char *password;
// Updating variables from GUI
UpdateData(TRUE);
//copying password from CString to char*
len = m_strPkcs12Password.GetLength();
password = (char *)malloc(sizeof(char)*len);
password = m_strPkcs12Password.GetBuffer(len);
in = BIO_new_file(m_strPkcs12FileName, "rb");
p12 = d2i_PKCS12_bio (in, NULL);
if (!p12) {
MessageBox("Error loading PKCS12 file", "Error", MB_OK);
}
ret = PKCS12_parse( p12, password, &privkey, &cert, &ca);
}
Pietro
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]