Call SetKeyWithIV(). Or, as mentioned in the reference manual for
NameValuePairs, you can also use the MakeParameters() function to create
your own NameValuePairs object.
----- Original Message -----
From: "Giuliano Bertoletti" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, December 07, 2006 10:36 PM
Subject: Re: Symmetric Cipher thorugh a Factory
At 09.42 07/12/2006 +0800, you wrote:
In 5.x, you'll want the factory to return a SymmetricCipher *, which is
the interface supported by both block ciphers (when used with a Mode
class) and stream ciphers. Then you can use StreamTransformationFilter to
use it with the BufferedTransformation interface.
StreamTransformationFilter also takes the object by reference. If you want
the StreamTransformationFilter object to delete the SymmetricCipher object
for you, you have to derive your own class from StreamTransformationFilter
and delete it in the destructor of the derived class.
Ok, I did as you say and it works (thank you).
It remains to be seen where and how I can supply the IV vector when I need
to.
I suspect I should use the SetKey function to do this. For example:
CryptoPP::SymmetricCipher *sc = new
CryptoPP::CBC_Mode<CryptoPP::DES_EDE3>::Encryption();
sc->SetKey(key,keysize);
CMyStreamTransformationFilter stf( sc );
thorws an exception on setkey because it expects an IV.
However I do not know how to feed this strange beast named
"NameValuePairs" with the IV as the SetKey prototype suggest I should do ?
Regards,
Giuliano Bertoletti