Hi,
I want to add a MAC to the Encryption Code below and then have the Decryption
code
fail if the MAC doesn't validate. Can someone please provide sample code to
achieve both of these. This is with Crypto++ 5.21. I've looked in the FAQ, and
Message Archives to no avail. Thanks.
typedef CryptoPP::StringSinkTemplate<string> STLStringSink;
// Encryption
// Encrypt the plaintext with AES with ciphertext stealing
CBC_CTS_Mode<AES >::Encryption aes_encryption( key, sizeof( key ), iv );
StringSource encrypt_pump( splaintext, true,
new StreamTransformationFilter( aes_encryption,
new
Base64Encoder( new STLStringSink( sencryptedb64 ) )
)
);
// Decrytion
// decrypt the message with AES
CBC_CTS_Mode<AES >::Decryption aes_decryption( key, sizeof( key ), iv );
StringSource decrypt_pump( sencryptedb64.c_str(), true,
new Base64Decoder( new
StreamTransformationFilter( aes_decryption, new STLStringSink( splaintext ) ) )
);
--
Best regards,
Neville Franks, Author of ED for Windows and Surfulater
Soft As It Gets Pty Ltd, http://www.getsoft.com - http://www.surfulater.com
Victoria, Australia mailto:[EMAIL PROTECTED]