Poco::CryptoOutputStream determine size

  aes, c++, c++14, encryption, poco-libraries

I decrypt file with Poco::CryptoOutputStream. File size after decryption is changed.

This is my code:

Poco::Crypto::Cipher::ByteVec iv {hex.begin(), hex.end()};
Poco::Crypto::CipherKey key("aes-128-cbc", _key, iv);
Poco::Crypto::Cipher::Ptr cipher = Poco::Crypto::CipherFactory::defaultFactory().createCipher(key);

Poco::FileInputStream src("./unit-tests/resources/cipher-stream/segment_000.m4s");
Poco::FileOutputStream dst("./unit-tests/resources/cipher-stream/segment_000_dec.m4s");

Poco::Crypto::CryptoOutputStream decryptor(dst, cipher->createDecryptor());
//<-- In that moment I want to know size of the dst file
Poco::StreamCopier::copyStream(src, decryptor);

Problem

I want to know size of the decrypted stream before decryption process is started. Can I do it?

Source: Windows Questions C++

LEAVE A COMMENT