This is a modified version of the code project article from Jeffery
Walton. It can be found at
http://www.codeproject.com/KB/security/BlockCiphers.aspx
#include "aes.h"
#include "files.h"
void encrypt(char inputFile[256]){
CryptoPP::CFB_Mode< CryptoPP::AES >::Encryption
Encryptor( key, sizeof(key), iv);
CryptoPP::StringSource( inputText, true,
new CryptoPP::StreamTransformationFilter( Encryptor,
new CryptoPP::StringSink( outputText )
) // StreamTransformationFilter
); // StringSource
}
void decrypt(char inputFile[256]){
// Decryptor
CryptoPP::CFB_Mode< CryptoPP::AES >::Decryption
Decryptor( key, sizeof(key), iv );
// Decryption
CryptoPP::FileSource( inputFile, true,
new CryptoPP::StreamTransformationFilter( Decryptor,
new CryptoPP::StringSink( outputText )
) // StreamTransformationFilter
); // StringSource
}
On Feb 23, 11:25 am, Andrew <[email protected]> wrote:
> this should work to encrypt
> FileSource( inputFile, true, new StreamTransformationFilter
> ( Encryptor, new StringSink( outputText )));
>
> and to decrypt you use this
> FileSource( inputFile, true, new StreamTransformationFilter
> ( Decryptor, new StringSink( outputText )));
>
> On Feb 23, 9:39 am, sebbo <[email protected]> wrote:
>
> > hi!
>
> > how can i encrypt binary data using crypto++ and aes? i would like to
> > encrypt picture and audio data but all my tries have failed. can you
> > help me?
>
> > thanks in advance
>
> > sebastian
--~--~---------~--~----~------------~-------~--~----~
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.
-~----------~----~----~----~------~----~------~--~---