[Code 02]
std::ofstream ofs(enc_file, std::ios_base::trunc);
ofs.write(reinterpret_cast<const char *>(iv.data()), iv.size() * sizeof(byte
) / sizeof(char));
FileSource(src_file.c_str(), true, new AuthenticatedEncryptionFilter(e, new 
FileSink(ofs)));

Like above.
The content in binary file "enc_file" is not "IV + encrypted".
I doubt FileSink Constructor "FileSink (std::ostream &out)" will modify 
std::ostream rather than continuing writing stream.


在 2018年6月26日星期二 UTC+8下午3:40:14,Jeffrey Walton写道:
>
>
>
> On Tuesday, June 26, 2018 at 2:13:25 AM UTC-4, Martin wrote:
>>
>> ...
>>
>> Question:
>>
>> FileSource(<src>, true, new AuthenticatedEncryptionFilter(e, new 
>> FileSink(<ofs>)));
>>
>> FileSink (std::ostream &out)
>>
>> Will CryptoPP::FileSink overwriter previous byte stream of <ofs>?
>>
>
> The FileSInk opens the stream using the default ostream flags. It should 
> truncate an existing file to 0. Also see 
> https://stackoverflow.com/q/39256916/608639 .
>
> Jeff
>

-- 
You received this message because you are subscribed to "Crypto++ Users". More 
information about Crypto++ and this group is available at 
http://www.cryptopp.com and 
http://groups.google.com/forum/#!forum/cryptopp-users.
--- 
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 cryptopp-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to