The reason that the Filter wrappers don't buffer and call SpecifyDataLengths() is that CCM is a special case that requires this. Its designers didn't know how to make it secure without cryptographically processing the data lengths before processing the actual data. Other authenc schemes do not have this issue, and I didn't want to introduce the additional complexity of buffering into the wrappers just for CCM.
The Filter wrappers are not meant to duplicate all of the underlying API of the algorithms, but just to make it easy to chain several algorithms together, and to make input/output easier, so I don't want to have it expose SpecifyDataLengths() and forward that to the underlying object. (If I did that for SpecifyDataLengths(), what about SetKey(), Resync(), etc?) The incomplete nature of Intellisense is admitted by Microsoft. It's supposed to be vastly improved in the next version (VS2010?) which will use the same compiler for Intellisense as for producing executable code. > For the third: due to the formatting function of CCM, the default > channel can not do anything with the [encrypted] data until I call > MessageEnd(). I believe this is because the authenticated data must be > know a priori. So forcing a call to SpecifyDataLength() before any > data is pushed to either of the channels seems tenuous to me. It > simply feels awkward. For CCM and GCM you have to input all AAD (via Update() on the AuthenticatedSymmetricCipher, or via the "AAD" channel on the Filter) first. As soon as you input any data to be encrypted/decrypted, Crypto++ assumes that AAD is finished. It will throw an exception if you attempt to input more AAD later. Other authenc schemes (not implemented yet) may also allow a "footer", which is AAD that you can input after the encrypted data. > First issue (I did not set the Key/IV). Perhaps an error about keying > would be more appropriate: > > CCM< AES, 96 >::Encryption e; > AuthenticatedEncryptionFilter ef( e, ... ) > > caught "Message length exceeds maximum" Thanks. I'll fix that. > ef.ChannelPut( "", (const byte*)pdata.c_str(), pdata.length() ); Calling ChannelPut() with "" or NULL_CHANNEL as channel name is always equivalent to just calling Put(), so you can make this slightly simpler. Please let me know if you had any comment that I failed to address. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to [email protected]. More information about Crypto++ and this group is available at http://www.cryptopp.com. -~----------~----~----~----~------~----~------~--~---
