Before PKCS7_dataInit(), try adding:
PKCS7_content_new(thePKCS7, NID_pkcs7_data)
U might also want to explore PKCS7_set_detached() to see if this applies for you.
-ET Tan
Luis Alberto Pérez Paz wrote:
Hi everybody, I need your help, I'm trying to make a PKCS7 signedAndEnveloped. I have read some examples about it, but I dont know where's my error.
there's a synthesis of my code:
/*********************************/ ..... .......
PKCS7 *thePKCS7 = NULL;
if( (thePKCS7 = PKCS7_new()) == NULL ) return false;
PKCS7_set_type(thePKCS7, NID_pkcs7_signedAndEnveloped);
if( PKCS7_add_signature(thePKCS7, certificate, priv_key, EVP_sha1()) == NULL ) return false;
PKCS7_add_certificate(thePKCS7, certificate);
if (!PKCS7_add_recipient(thePKCS7,certificate_recipient)) return false;
PKCS7_set_cipher(thePKCS7, EVP_des_ede3_cbc());
BIO *thePKCS7DataBio = NULL; if ((thePKCS7DataBio=PKCS7_dataInit(thePKCS7, NULL )) == NULL) return false;
if( BIO_write(thePKCS7DataBio, buffer, sizeof (buffer) ) <= 0 ) return false;
BIO_flush(thePKCS7DataBio);
if( !PKCS7_dataFinal(thePKCS7, thePKCS7DataBio) ) return false;
.... ......
/*********************************/
The code compile however when I try to run it, the program and my terminal (windows XP) crash in the PKCS7_dataInit
<< thePKCS7DataBio=PKCS7_dataInit(thePKCS7, NULL ) >>
Any ideas / suggestions?
thanks in advance,
Luis A Perez
______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager [EMAIL PROTECTED]