There is a mistake in what I wrote :

if(!(out=BIO_new_file(ficDest,"rb"))) {
   return -1;
}

is actually

if(!(out=BIO_new_file(ficDest,"wb"))) {
   return -1;
}


Florian Manach
NUMLOG
[EMAIL PROTECTED]
(+33)0130791616

Florian MANACH a écrit :
Hi,

I'm trying to create a PKCS7 encryption software and I have some issues doing it.

My call to the PKCS7_encrypt function leads to a segmentation fault.
The core dump shows :
---------------------------------------------------------------------
(gdb) where
#0  0x400b7a0f in EVP_CIPHER_type () from /usr/lib/libcrypto.so.0.9.7
#1  0x00000017 in ?? ()
#2  0x40125a08 in ?? () from /usr/lib/libcrypto.so.0.9.7
#3  0x0809b7f8 in ?? ()
#4  0x400edf1e in PKCS7_set_cipher () from /usr/lib/libcrypto.so.0.9.7
#5  0x00000000 in ?? ()
#6  0x00000000 in ?? ()
#7  0xbffff2d0 in ?? ()
#8 0x4000a9c4 in fixup (l=0x809b7f8, reloc_offset=1074897320) at dl-runtime.c:98
---------------------------------------------------------------------

Here is the code I use :
---------------------------------------------------------------------
if((fichier=fopen(certifDistant,"rb"))==NULL) {
   return -1;
}
encerts=sk_X509_new_null();
if((recept=d2i_X509_fp(fichier,NULL))==NULL) {
   return -1;
}
sk_X509_push(encerts,recept);
fclose(fichier);
if(!(in=BIO_new_file(entree,"rb"))) {
   return -1;
}
                        if(!(out=BIO_new_file(ficDest,"rb"))) {
   return -1;
}
if((p7=PKCS7_encrypt(encerts,in,cipher,PKCS7_BINARY))==NULL) {
   return -1;
}
----------------------------------------------------------------------

You surely need to know that I'm using OpenSSL 0.9.8d (28 Sep 2006) compiled on Linux Mandrake 10.1.

Thank you for your help.

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to