Excited to tell you that our welfare activity has been upgraded - Paying only $5.00 + Freight to get JCOP J3H145 card and A40CR card.
Please check this post for more details.

Moreover, if you want to get Free Samples by Paying Freight only , please check this page.

A question of PKCS5

JavaCard Applet Development Related Questions and Answers.
DaHuFa
Posts: 35
Joined: Mon Jun 04, 2018 5:07 am
Points :242
Contact:

A question of PKCS5

Post by DaHuFa » Mon Sep 17, 2018 1:22 am

Hi, everyone.
Anyone know how to calculate PKCS5 padding algorithm?
I knew that the PKCS5 padding algorithm fills bytes at the end of data until the length of total data is multiple block size.
For example, AES block size is 32 bytes. And the data is 30 bytes. The padding bytes is "0202". If the data is 28 bytes, the padding bytes will be "04040404". But If the data length is 32 bytes too, whether I should add 32bytes padding bytes?

AlexLiu
Posts: 17
Joined: Thu Sep 22, 2016 4:52 am
Points :206
Contact:

Re: A question of PKCS5

Post by AlexLiu » Tue Sep 18, 2018 2:38 am

(1) AES block size is not 32 bytes, it is 16 bytes;
(2) if the data is 16 bytes, you still need to pad 0x10 to the end until its length is 32bytes;
(3) you need to pad at any case, even if the length is times of block size.

DaHuFa
Posts: 35
Joined: Mon Jun 04, 2018 5:07 am
Points :242
Contact:

Re: A question of PKCS5

Post by DaHuFa » Tue Sep 18, 2018 6:19 am

yeah, I will try it.

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 2 guests

JavaCard OS : Disclaimer