Wow! That was quick....
I'd compress, then encrypt, then base-64 encode. At the other end I'd have
to base-64 decode, then decrypt, then uncompress.
Note that it would be a very good idea to use a MAC on the ciphertext and
append the MAC to the ciphertext before base-64 encoding. The MAC has
a fixed length, so it would be easy to "strip off" (after base-64 decoding)
and
verify before decrypting. That ensures that the ciphertext has not been
tampered with or otherwise corrupted before attempting to decrypt. If the
ciphertext is currupted, it won't decrypt correctly.
Rickey
----- Original Message -----
From: "Stephen torri" <[EMAIL PROTECTED]>
To: "cryptopp" <[EMAIL PROTECTED]>
Sent: Saturday, November 15, 2003 4:40 PM
Subject: Re: Decryption in CFB_Mode<AES>
> On Sat, 2003-11-15 at 16:19, Rickey Braddam wrote:
> > Hello again, Stephen.
> >
> > If you encrypt then base-64 encode, you must base-64 decode then decrypt.
You
> > are attempting to decrypt base-64 encoded ciphertext, not the ciphertext
> > itself.
> >
> > >From test.cpp:
> > string DecryptString(const char *instr, const char *passPhrase)
> > {
> > string outstr;
> >
> > HexDecoder decryptor(new DefaultDecryptorWithMAC(passPhrase, new
> > StringSink(outstr)));
> > decryptor.Put((byte *)instr, strlen(instr));
> > decryptor.MessageEnd();
> >
> > return outstr;
> > }
> >
> > Which means your cfbDecrypter should look more like:
> > StreamTransformationFilter *cfbDecryptor =
> > new StreamTransformationFilter (aes_decrypt,
> > new StringSink (plaintext));
> >
> >
> > and your StringSource should look more like:
> > StringSource source (new Base64Decoder(ciphertext), true, cfbDecryptor);
> >
> > NOTE that I haven't tested this, you may have to make some "adjustments"
to
> > it.
> > I don't use them quite like that.
> >
> > Rickey
>
> Ultimately the transformations to the plain text I would are to compress
> the data first then encrypt.
>
> What would you do? I am open to suggestions and education.
>
> Stephen
>