In order to thank you for all members' support of our website, we are holding new events - Getting Free Samples by Paying Freight only.
Want to get free samples? Please check this post for more details.

Why the byte length of KeyAgreement.generateSecret() is 20

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

Why the byte length of KeyAgreement.generateSecret() is 20

Post by DaHuFa » Fri Jul 13, 2018 5:10 am

Hello,
I write a applet to implement KeyAgreement recently. I create a 256 bits EC key, then call KeyAgreement.generateSecret(). In the end, the length of result is 20 bytes. Why? My EC key length is 256 bits, 32 bytes. Why my result length is 20 bytes?

happy123654
Posts: 19
Joined: Wed Jun 20, 2018 4:06 am
Points :98
Contact:

Re: Why the byte length of KeyAgreement.generateSecret() is 20

Post by happy123654 » Fri Jul 13, 2018 5:12 am

Because the function implements SHA_1 calculation in the last step.

DaHuFa
Posts: 27
Joined: Mon Jun 04, 2018 5:07 am
Points :190
Contact:

Re: Why the byte length of KeyAgreement.generateSecret() is 20

Post by DaHuFa » Fri Jul 13, 2018 5:29 am

But my sample card which installed other's applet return 32 bytes. I think there maybe something I don't know....

BirdKing
Posts: 36
Joined: Wed Nov 04, 2015 7:23 am
Points :254
Contact:

Re: Why the byte length of KeyAgreement.generateSecret() is 20

Post by BirdKing » Fri Jul 13, 2018 5:42 am

The sample applet maybe use ALG_EC_SVDP_DH_PLAIN.

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 2 guests

JavaCard OS : Disclaimer