To follow up on this thread - if I wanted to utilize Rijndael in CBC mode
with PKCS#5 padding in Cryptopp 5.1, I assume I need to utilize the
CBC_Mode<Rijndael> class, but how does one specify padding in this instance?
Are you left to implement your own? Was the CBCPaddedEncryptor of 4.2 not
carried forward?

Or is it assumed to be PKCS#5? What is the mode and padding of the
default RijndaelEncryption/Decryption?

Many Thanks for any insight...

Tom Cowin


At 06:22 PM 5/25/2003 +0400, Yusuf Khan-YUK wrote:
Thanx Giuliano

I am happy to store the file size in the encrypted file and then
retrieve it during decryption.

On 20 May 2003 at 14:45, Giuliano Bertoletti wrote:

>
>
> Yusuf Khan-YUK wrote:
>
> > I tried using BlockSize() but my output was still the same. Thats
> > because in my case, the the key size was 16 and BlockSize() also
> > returned 16.
>
> There in another mistake in your code, which I did not immediately
> noticed; when you call:
>
> fread(buffer,sizeof(byte), KEYSIZE,fp);
>
> you're assuming the input is multiple of KEYSIZE (or better of
> BlockSize).
> If that's not true, you implicitly append zeros at the end of your file
> to allign with the block.
> When the decryptor reverses the process it has no way of knowing the
> real file size, and therefore he cannot truncate the file correctly (how
> does it know how many zeros really belong to the plain-text file ?).
>
> You have either to store the plain file length in the encrypted file or
> to use/implement some padding scheme. Look at previous messages, there's
> one named "questions on data block size?" where you can find an example.
>
> > The version of crypto++ I am using is 4.2, in AESEcnryptor you can
> > only specify the key, you cannot specify the password, or the iv
>
> That's because it is only an encryptor. But you can easily convert a
> password into a key using an hash function (say MD5). In this way you
> can take variable length input password.
>
> The IV can be specified through a CBCPaddedEncryptor for example, which
> can take the encryptor object (in your case AES) and the IV.
>
> --
> Giuliano Bertoletti
> e-Security Manager
>
>
> Intrinsic - Security Monitoring
> http://www.intrinsic.it
>
> COOL-FIRE: la soluzione Firewall per Windows NT/2000
> http://www.symbolic.it/Prodotti/cool-fire.html
>
> SYMBOLIC S.p.A. Tel: +39 0521 776180 / Fax: +39 0521 776190
>


Best Regards YUK



Reply via email to