> Is it possible to specify a ChannelSwitch as the sink in the filter?
Yes.
Also, I added two additional member functions to
AuthenticatedSymmetricCipher. These might be easier to use than the Filter
wrappers, when you have just a short message to encrypt/decrypt.
//! encrypt and generate MAC in one call. will truncate MAC if macSize <
TagSize()
virtual void EncryptAndAuthenticate(byte *ciphertext, byte *mac, size_t
macSize, const byte *iv, int ivLength, const byte *header, size_t
headerLength, const byte *message, size_t messageLength);
//! decrypt and verify MAC in one call, returning true iff MAC is valid.
will assume MAC is truncated if macLength < TagSize()
virtual bool DecryptAndVerify(byte *message, const byte *mac, size_t
macLength, const byte *iv, int ivLength, const byte *header, size_t
headerLength, const byte *ciphertext, size_t ciphertextLength);
They are implemented as follows:
void AuthenticatedSymmetricCipher::EncryptAndAuthenticate(byte *ciphertext,
byte *mac, size_t macSize, const byte *iv, int ivLength, const byte *header,
size_t headerLength, const byte *message, size_t messageLength)
{
Resynchronize(iv, ivLength);
SpecifyDataLengths(headerLength, messageLength);
Update(header, headerLength);
ProcessString(ciphertext, message, messageLength);
TruncatedFinal(mac, macSize);
}
bool AuthenticatedSymmetricCipher::DecryptAndVerify(byte *message, const
byte *mac, size_t macLength, const byte *iv, int ivLength, const byte
*header, size_t headerLength, const byte *ciphertext, size_t
ciphertextLength)
{
Resynchronize(iv, ivLength);
SpecifyDataLengths(headerLength, ciphertextLength);
Update(header, headerLength);
ProcessString(message, ciphertext, ciphertextLength);
return TruncatedVerify(mac, macLength);
}
--~--~---------~--~----~------------~-------~--~----~
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.
-~----------~----~----~----~------~----~------~--~---