Discussion:
AES CBC using PKCS#5 padding
(too old to reply)
freddy parra
2005-04-19 00:41:03 UTC
Permalink
Hi,
I want to encrypt a string using AES CBC using PKCS#5 padding.
The AES CBConly seems to support PKCS7 padding
(the PaddingMode enumeration contains 'PKCS7' and 'Zeroes').
How do I do PKCS5 padding?
/Freddy
Valery Pryamikov
2005-04-19 06:13:44 UTC
Permalink
Hi,
PKCS#5 and PKCS#7 specifies the same padding scheme:
to repeatedly appends bytes each of them containing total amount of padded
bytes.
ie. if you need 5 bytes to pad your message, then padding will be
{5,5,5,5,5}.

-Valery.
http://www.harper.no/valery
Post by freddy parra
Hi,
I want to encrypt a string using AES CBC using PKCS#5 padding.
The AES CBConly seems to support PKCS7 padding
(the PaddingMode enumeration contains 'PKCS7' and 'Zeroes').
How do I do PKCS5 padding?
/Freddy
lelteto
2005-04-19 15:29:05 UTC
Permalink
PKCS#5 padding is the default (and I think only) supported padding in CAPI,
so you won't need to worry.

BTW if you need any other type of padding (or no padding at all for full
blocks) this is what you need to do:
Do your own padding of the last block (or don't pad if that's full block and
you actually don't want padding - eg. you send the size in some other way)
then call CryptEncrypt with Final still set to FALSE; then simply abandon
your encryption process (or encrypt a dummy block and trown it away).

Laszlo Elteto
SafeNet, Inc.
Post by freddy parra
Hi,
I want to encrypt a string using AES CBC using PKCS#5 padding.
The AES CBConly seems to support PKCS7 padding
(the PaddingMode enumeration contains 'PKCS7' and 'Zeroes').
How do I do PKCS5 padding?
/Freddy
freddy parra
2005-04-21 01:07:04 UTC
Permalink
I need implements PKCS#5 padding in .NET with Rijndael Class (AES)

its possible?
Post by freddy parra
Hi,
I want to encrypt a string using AES CBC using PKCS#5 padding.
The AES CBConly seems to support PKCS7 padding
(the PaddingMode enumeration contains 'PKCS7' and 'Zeroes').
How do I do PKCS5 padding?
/Freddy
Loading...