When I followed the instructions in Botan document Pipe/Filter Message Processing, I was faced with an unexpected failbit error.
My code is very simple:
ifstream in("2.txt", ios::binary);
ofstream out("2.enc", ios::binary);
AutoSeeded_RNG rng;
SymmetricKey key(rng, 16); // a random 128-bit key
InitializationVector iv(rng, 16); // a random 128-bit IV
Pipe pipe(get_cipher("AES-128/CBC/CTS", key, iv, ENCRYPTION), new DataSink_Stream(out));
pipe.start_msg();
in >> pipe;
pipe.end_msg();
cout << in.fail() << endl;
It would always output 1, since the failbit is always set to 1.
Is this a bug or is there something wrong with my code?