Hello Russell!

I wanted to ask you question about padding. IFAIK the CFB encryption
 mode produces the same output buffer size and input, and in the sample:
http://www.eskimo.com/~weidai/cgi-bin/fom-serve/cache/79.html
there is the same size for output buffer as for input. This is the CFB mode
 design to produce the same length buffer, am I wrong?

Best Regards,
Konstantion

----- Original Message -----
Sent: Wednesday, June 02, 2004 3:05 AM
Subject: Re: SymmetricCipher Decoder is not working if created dynamically.

Hi Cornel,

Cornel>         cfbEncryption.ProcessData(chiper, plain,bSize);
Cornel>         cfbDecryption.ProcessData(out_plain, chiper,bSize);

Cornel>         cfbEncrypt->ProcessData(chiper2, plain, bSize);
Cornel>         cfbDecrypt->ProcessData(out_plain, chiper2, bSize);

I'm not sure, but I'm surprised that either works....you've assumed
that the ciphertext is the same length as the plaintext.  That, in
general, is not true.  I think it can only be true if the plaintext is
a multiple of a block size for the underlying cipher.

If it isn't (which ususally isn't), you need to use padding.

In any case, decryption with
   ProcessData(out_plain, chiper2, bSize)
is almost certainly wrong.

In fact, your call to
   cfbEncryption.ProcessData(chiper, plain,bSize);

is probably scribbling over the stack.  That's why CrytoPP has the
Source and Sink classes to work with variable length data.
You really need to be using those.

--
Russell Robinson (mailto:[EMAIL PROTECTED])
Author of Tectite (CRM and Licensing for Software Developers)
Download your free CRM from: http://www.tectite.com/


Reply via email to