On Tuesday, December 22, 2015 at 6:15:04 PM UTC-5, [email protected] wrote: > > I've refactored my code several times. > > You say " You should probably call MessageEnd() on the > StreamTransformationFilter." > I'm not sure how I get to the STF now, as my code now looks like: > > CryptoPP::CFB_Mode<CryptoPP::AES>::Encryption *e = new > CryptoPP::CFB_Mode<CryptoPP::AES>::Encryption((const byte *)_key.constData(), > _key.length(), (const byte *)binIv.constData(), 1); > > _fileSource->Attach(new CryptoPP::MeterFilter); > > _fileSource->Attach(new CryptoPP::StreamTransformationFilter(*e)); > > if (_base64Output) { > > _fileSource->Attach(new CryptoPP::Base64Encoder()); > > } > > _fileSource->Attach(new CryptoPP::FileSink(outFilename_)); > > > I changed my pump function to be: > > void Hash::aesEncryptFilePump() { > > qlonglong readLength = qMin(_blockSize, totalBytesToEncrypt - > bytesEncrypted); > > qlonglong remainder = _fileSource->Pump(readLength); > > _fileSource->AttachedTransformation()->MessageEnd(); > > bytesEncrypted += readLength - remainder; > //_fileSource->Pump(readLength); > > emit bytesEncryptedChanged(bytesEncrypted); > > if (_fileSource->SourceExhausted()) > > { > > aesEncryptFileClose(); > > emit aesEncryptFileComplete(inFilename); > > } > > } > > > Which seems to be what is needed per > https://www.cryptopp.com/wiki/User_Guide:_filters.h However you mentioned > calling it on the STF. Shouldn't the MessageEnd() cascade down? > > You should only call MessageEnd() after you have finished encrypting the entire file. MessageEnd() will do things like add padding, if needed. In this respect, I would expect it inside the `_fileSource->SourceExhausted()` conditional.
Jeff -- -- 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. --- You received this message because you are subscribed to the Google Groups "Crypto++ Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
