I try to encrypt an binary file (.dll) by aes.
string b64dll;
CryptoPP::StringSink ssink(b64dll);
Base64Encoder b64;
CryptoPP::FileSink fsink(s.c_str());
FileSource f(argv[1], true,
new StreamTransformationFilter(Encryptor,
new Base64Encoder(new CryptoPP::FileSink(s.c_str
()))));
and save the result in Base64 format.
First I decode base64 file
FileSource f(argv[1],true,new Base64Decoder(new StringSink
(ss64)));
than I decrypt
StringSource as(ss64,true,new StreamTransformationFilter
(Decryptor,new StringSink(cc64)));
If I save to string, I got only "MZ".
If save to FileSink, I got the correct file.
If save to ArraySink, I have to give the size of data.
The interesting part is, if I am encrypting an ascii file, decrypt to
StringSink is fine.
Could anyone give a hint how to decrypt binary data to memory?
Thanks.
--~--~---------~--~----~------------~-------~--~----~
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.
-~----------~----~----~----~------~----~------~--~---