On Mon, Oct 14, 2002 at 10:43:59PM -0400, Zooko wrote:
> DES_XEX3_Encryption encryption(self->key);
> CBC_CTS_Encryptor encrypter(encryption, iv);
> encrypter.Put(text, textlength);
> encrypter.Close();
> encrypter.Get(ciphertext, textlength);

You can still do it in this style, using the BufferedTransformation interface:

CBC_CTS_Mode<DES_XEX3>::Encryption encryption(self->key, 24, iv);
StreamTransformationFilter encrypter(encryption);
encrypter.Put(text, textlength);
encrypter.MessageEnd();
encrypter.Get(ciphertext, textlength);

or more efficiently:

StreamTransformationFilter encryptor(encryption, new ArraySink(ciphertext, 
textlength));
encryptor.PutMessageEnd(text, textlength);

> The features of StreamTransformation which are included for CTS purposes, like 
> ProcessLastBlock and MinLastBlockSize give me a compile error when I try to 
> use them, which is confusing:
> 
> /home/zooko/playground/mnet/extsrc-HEAD/cryptopp/modes.h: In function
>    `PyObject* tripledescbc_decrypt(tripledescbc*, PyObject*)':
> /home/zooko/playground/mnet/extsrc-HEAD/cryptopp/modes.h:241: `virtual unsigned
>    int CryptoPP::CBC_CTS_Decryption::MinLastBlockSize() const' is private
> tripledescbc.cpp:201: within this context

Sorry, those functions should be public. I've fixed it in CVS. It wasn't detected
because in the test code (and in StreamTransforamtionFilter), CBC_CTS_Decryption
is downcast to StreamTransformation before being used, and those functions are
public members of StreamTransformation.

Reply via email to