NOTES: PKCS5 and PKCS7 padding for symmetric encryption algorithms

Source: Internet
Author: User

The PKCS #7 padding string consists of a sequence of bytes, each of which fills the length of the filled byte sequence.

Suppose that the length of the block is 8 and the data length is 5

Data: aa AA, AA AA AA

pkcs#7 filling AA aa aa aa 03 03 03

PKCS5, PKCS7, SSL3, and CMS (cryptographic Message Syntax)

Has the following characteristics:

1, the filled bytes are the same byte

2, the value of this byte is the number of bytes to be populated

For example, to populate 5, the padding value is 0x5

To fill 1, the padding value is 0x1

Reprinted from: http://zhiwei.li/text/2009/05/17/%E5%AF%B9%E7%A7%B0%E5%8A%A0%E5%AF%86%E7%AE%97%E6%B3%95%E7%9A%84pkcs5%E5% 92%8cpkcs7%e5%a1%ab%e5%85%85/

NOTES: PKCS5 and PKCS7 padding for symmetric encryption algorithms

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.