[Top] [All Lists]

RE: digested-data, surreptitious forwarding, D-H

2002-07-28 20:55:15

Trevor Perrin <Tperrin(_at_)sigaba(_dot_)com> writes:

Interesting, I'd assumed that you could do multiple layers (like a
digestedData and envelopedData, or signedData and envelopedData) in a single
pass, by hashing and then encrypting each content block, then moving to the
next one, etc..  You're saying that this isn't possible, 

It isn't, because of ASN.1 encoding restrictions.  Changing a single byte of
inner content can change several bytes of outer content due to variable-length
length-of-length encoding, and there are some data lengths which can never be
achieved, eg. when you move from a short-encoded data length to a long-encoded
one and adding a single byte to the data also increases the length-of-length
value.  When you combine this with data blocking requirements and requirements
for PKCS #5 padding, it becomes unworkably complex to implement and test unless
you buffer an entire message, in which case you're just doing a standard two-
pass encoding.

but the scheme below can be done in one pass?

Sure, since the encoding is one-step.  With DigestedData you're encapsulating
the entire data block just to add a 20-byte hash at the end.  All this does
it add the hash at the end of the EncryptedData.