Hello, I still haven't figured out the way to pass a pkcs7 object to a
char *. I think I understand everything I must do, but it still doesn't
work.

************************************************
sign(x509,pkey,data,p7); /*First, we obtain the p7 object*/

PEM_write_PKCS7(stdout,p7); /*we write in the stdout ok*/

  i=i2d_PKCS7(p7,NULL); /*we get the p7 size*/

  msg_aux=(char *)malloc(i);
  memset(msg_aux,0,i);

  databio=BIO_new(BIO_s_mem());   /*we build a bio object to store the
data into a char * */
  databio=(BIO *) Malloc(i*1024);
  BIO_reset(databio);
  BIO_set_mem_buf(databio,msg_aux,BIO_CTRL_RESET);

  b64a=BIO_new(BIO_f_base64()); /*we build a bio object with a filter to
transform from  internal  rep. to  der.*/
  b64a=(BIO *) Malloc (i*1024);        /*Then, we apply the filter to
obtain a readable string. */
  BIO_reset(b64a);
  b64b=b64a;                                            /*we use another
bio to keep the pointer to the first mem. position*/

   if (!( i=i2d_PKCS7_bio(b64a,p7)))
      ERR_print_errors(stdout);

  databio=BIO_push(b64b,databio);

  printf("printing  PKCS7 \n%s\n",msg_aux);

************************************************************+
This last i2d call returns 0,  and the subsequent error messages:
7929:error:2006F078::lib(32) :func(111) :reason(120):bio_lib.c:158:
7929:error:20067079::lib(32) :func(103) :reason(121):bio_lib.c:302:
7929:error:20067079::lib(32) :func(103) :reason(121):bio_lib.c:302:
7929:error:20067079::lib(32) :func(103) :reason(121):bio_lib.c:302:
7929:error:20071079::lib(32) :func(113) :reason(121):bio_lib.c:183:

we try to understand what's the problem by looking at the lines
specified above in file bio_lib.c, but ######!!!!!!!
Could anybody be so kind to explain us what we are doing wrong ?


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

Reply via email to