PKCS#7 enveloped objects and ciphers

2002-09-17 Thread TJ Saunders


Hello, OpenSSL developers.  I ran across an interesting thing while
working with openssl-0.9.7beta2, and am wondering if it's a bug, or is
intentional.  I have signed some data, creating a PKCS7 signed object.
I've then encrypted that signed object, creating an enveloped object.  At
each step in this process, I'm displaying the various attributes and
structs members (in a way that unhealthily violates the opacity of
objects, I admit).  The interesting case is this: I write the enveloped
object out via PEM_write_bio_PKCS7(), and then read it back in using
PEM_read_bio_PKCS().  The enveloped object read back in seems to be same
as that written out -- except that p7-d.enveloped-enc_data-cipher is
NULL, where it was not NULL when being written out.

I looked into the PKCS7_dataDecode() routine, to see how it decrypted an
eveloped object's encrypted contents without using that cipher.  It
apparently does so by using p7-d.enveloped-enc_data-algorithm to get
the matching(?) cipher by name.

Is this use (and lack of) of that enc_data-cipher member intentional?  Or
perhaps this is a case specific to working with enveloped objects?  Or,
most likely, I am missing something. =)

Cheers,

TJ



   Absence is to love what wind is to fire: it extinguishes the small, it
   enkindles the great.

-Comte de Bussy-Rabutin


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



Re: PKCS#7 enveloped objects and ciphers

2002-09-17 Thread Dr. Stephen Henson

On Tue, Sep 17, 2002, TJ Saunders wrote:

 
 Hello, OpenSSL developers.  I ran across an interesting thing while
 working with openssl-0.9.7beta2, and am wondering if it's a bug, or is
 intentional.  I have signed some data, creating a PKCS7 signed object.
 I've then encrypted that signed object, creating an enveloped object.  At
 each step in this process, I'm displaying the various attributes and
 structs members (in a way that unhealthily violates the opacity of
 objects, I admit).  The interesting case is this: I write the enveloped
 object out via PEM_write_bio_PKCS7(), and then read it back in using
 PEM_read_bio_PKCS().  The enveloped object read back in seems to be same
 as that written out -- except that p7-d.enveloped-enc_data-cipher is
 NULL, where it was not NULL when being written out.
 
 I looked into the PKCS7_dataDecode() routine, to see how it decrypted an
 eveloped object's encrypted contents without using that cipher.  It
 apparently does so by using p7-d.enveloped-enc_data-algorithm to get
 the matching(?) cipher by name.
 
 Is this use (and lack of) of that enc_data-cipher member intentional?  Or
 perhaps this is a case specific to working with enveloped objects?  Or,
 most likely, I am missing something. =)
 

The field isn't one of OpenSSLs ASN1 types so it isn't written out or read in
when the structure is encode/decoded. Its just used as a temporary location to
store a cipher during processing by the S/MIME routines.

Steve.
--
Dr. Stephen Henson  [EMAIL PROTECTED]
OpenSSL Project http://www.openssl.org/~steve/
__
OpenSSL Project http://www.openssl.org
Development Mailing List   [EMAIL PROTECTED]
Automated List Manager   [EMAIL PROTECTED]