Our Online Store have the new products: RFID antenna board. Currently it can work with JC10M24R and JCOP4 card chips.
Compared with normal cards, the antenna board module has a smaller size and fixed holes, which is easy to integrate in the IOT(Internet Of Things) project.

A question of PKCS5

JavaCard Applet Development Related Questions and Answers.
DaHuFa
Posts: 53
Joined: Mon Jun 04, 2018 5:07 am
Points :392
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: 53
Joined: Mon Jun 04, 2018 5:07 am
Points :392
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 36 guests

JavaCard OS : Disclaimer