0
$\begingroup$

As far as I know there are two padding mechanisms, which are PKCS 5 and 7. Which one should be used for CBC?

$\endgroup$
0

1 Answer 1

1
$\begingroup$

They are, effectively, the same thing.

PKCS#5 describes a padding that wrote down 8-n padding bytes, but was only valid for DES and RC2.

PKCS#7 described a padding scheme which wrote down k-n bytes for a k-byte block cipher.

Most libraries call the scheme PKCS#7 padding, since that’s the more generalized one (and is defined for AES), but some decided that “7 fixed 5, so credit really goes to 5”.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.