> From: Jaco De Villiers [mailto:jac...@infoslips.com]
> 
> When I encrypt data (zero padded) using Rinjael in my C# application and
> then encrypt the same data using the BouncyCastle portable library then I
> get a similar result expect that the BouncyCastle library adds 16 bytes at the
> end of the encrypted data.  Rinjael returns 160 bytes and BouncyCastle
> returns 176 bytes of which the first 160 is the same as the Rinjael library

Rijndael is just a block cipher. It will always encrypt blocks of 16 bytes, so 
if your output is a different size, it means your input was a different size. I 
suggest you double-check what your exact input is - After padding, evidently, 
you're getting an extra block.

Normally you don't want to use zero-padding, because it's impossible to 
distinguish a series of zeroes from a series of real data that happen to end in 
zeroes. Zero padding is only for when you know the exact length of your data, 
but it's not a multiple of the blocksize. If you know the exact length of your 
data is a multiple of blocksize, then use No padding. For normal usage, I would 
suggest basically any other padding scheme - PKCS7, X923, or ISO10126, are the 
ones supported by the Microsoft AES classes.

Reply via email to