Ignacio Gil wrote:
>
> Hello,
> I need to transform a PKCS7* to a char* or similar, and I've done this:
>
> unsigned char **msg_aux;
> msg_aux=(unsigned char **) malloc (8194); /*enough size...*/
> i=i2d_PKCS7(p7,msg_aux);
>
> I've got a segmentation fault.
> Could anybody help me?
The correct way is this...
int len;
unsigned char *buf, *p;
len = i2d_PKCS7(p7, NULL);
buf = malloc(len);
p = buf;
i2d_PKCS7(p7, &p);
Steve.
--
Dr Stephen N. Henson. http://www.drh-consultancy.demon.co.uk/
Personal Email: [EMAIL PROTECTED]
Senior crypto engineer, Celo Communications: http://www.celocom.com/
Core developer of the OpenSSL project: http://www.openssl.org/
Business Email: [EMAIL PROTECTED] PGP key: via homepage.
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]