From implicit envelope to detached envelope

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

From implicit envelope to detached envelope

Pablo J Royo
Hello all:
 
I´m tryng to generate a detached envelope from a received implicit (non-detached) envelope.
The idea is to load the old non-detached envelope, to copy it in a new PKCS7 envelope struct and then to delete the encrypted data from that struct and dump it with i2d_PKCS7_bio to a memory BIO. 
 
So, is this correct?:
 
 p7_new->d.enveloped->recipientinfo = p7_old->d.enveloped->recipientinfo; //get recipients info from old envelope and asing it to new
 
 p7_new->d.enveloped->enc_data = p7_old->d.enveloped->enc_data; //get PKCS7_ENC_CONTENT enc_data object
 
 p7_new->d.enveloped->enc_data->enc_data = NULL; //put its data to NULL
 p7_new->d.enveloped->enc_data->content_type = NULL;
  /
 
 i2d_PKCS7_bio( mem_bio,p7_new); //Dump to memory
 
My doubt is with the content_type. Should I put NULL ?
Also, What must be NULL: p7_new->d.enveloped->enc_data->enc_data  or p7_new->d.enveloped->enc_data ?
 
Thanks