"Android" pkcs#5 fill and pkcs#7 fill comparison

Source: Internet
Author: User
Tags pkcs7

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.