0
$\begingroup$

This question already has an answer here:

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

$\endgroup$

marked as duplicate by Maarten Bodewes, e-sushi Aug 14 '18 at 14:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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.