x x wrote:
I need source code to encrypt and decrypt a buffer of bytes with
DES in CBC mode. I have searched the web and the crypto++ website but I
haven't found any example of this.
Thanks in advance
Ian
Yahoo!
Acesso Grátis - Internet rápida e grátis. Instale o discador agora!
std::string ciphertext;
std::string plaintext = "test test test";
CBC_Mode<DES>::Encryption cbcEncryption;
StreamTransformationFilter cbcEncryptor(cbcEncryption, new StringSink(ciphertext));
cbcEncryptor.Put(plaintext, plaintext.size());
cbcEncryptor.MessageEnd();
//something like this :)
//ciphertext now contains encrypted message.
This example used std::string as buffer to hold the data.
You can also use CryptoPP internal buffers.
Read the CryptoPP Faq-O-Matic.
http://www.eskimo.com/~weidai/cgi-bin/fom-serve/cache/79.html
|