1. The same point:
There is no difference between the pkcs#5 fill and the Pkcs#7 fill algorithm.
Their fill string consists of a sequence of bytes, each of which fills the length of the filled byte sequence .
Assuming a block length of 8 and a data length of 9,
Data: FF FF FF FF FF FF FF FF
PKCS7 filling: FF FF FF FF FF FF FF FF 07 07 07 07 07 07 07
Simply put, PKCS5, PKCS7 and SSL3, as well as CMS (cryptographic Message Syntax)
The following features are the same:
1) The bytes that are filled are the same byte
2) The value of this byte, which is the number of bytes to be populated
If you are populating 8 bytes, then the value of the populated bytes is 0x8;
To fill 7 bytes, the filled value is 0x7;
...
If only 1 bytes are populated, then the value entered is 0x1;
A 0x08 of 8 bytes at exactly 8 bytes
It is this one that, even if it happens to be 8 bytes, requires the addition of bytes, allowing the decrypted data to remove the extra bytes with certainty.
2. Different points:
In pkcs5padding, it is clear that the size of the block is 8 bits, whereas in the pkcs7padding definition, the size of the block is indeterminate and can be between 1-255 (the block length exceeds 255 of the pending study).
"Android" pkcs#5 fill and pkcs#7 fill comparison