I'm having problem with unwarpping/decoding/deciphering a file.
 
Here's how the file is encrypted:
 
  CBC_Mode<AES>::Encryption encrAES;    
   byte aesKey[32], aesIV[16]; 
   rng.GenerateBlock(aesKey, 32);  rng.GenerateBlock(aesIV,  16);
   encrAES.SetKeyWithIV(aesKey, 32, aesIV);

   Base64Encoder *baseEnc = new Base64Encoder(new FileSink("encoded.txt"));
   StreamTransformationFilter aesEnc(encrAES, baseEnc);
   aesEnc.Put(plainText, sizeof(plainText));
   aesEnc.MessageEnd();
   ............repeat the last two multiple times...........
 
Then I feed the data to aesEnc and it works fine.
 
Now I'm trying to reverse this process, and unwrap the contents of that file
record by record. So ideally I need something like
FileSource(file)->Base64Decoder->Decryptor, from which I can Get() my data
back.
 
However I fail miserably in attempts to do something like:
 
  Base64Decoder *b6d = new
       Base64Decoder(new FileSource("encoded.txt", true));
  StreamTransformationFilter aesDec(b6d, decrAES);
 
I'm sure you understand what it is that I'm trying to accomplish.  It is
clear that I haven't gotten the hang of filters and piping in Crypto++, so
I'm not connecting/using the right pieces.  What is the best way to do what
I'm trying to achieve?
 
In the above code, decrAES is decryptor that reverses encrAES  (of course
:-).
 
Thank you!
 

--~--~---------~--~----~------------~-------~--~----~
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.
-~----------~----~----~----~------~----~------~--~---

Reply via email to