JavacardOS will not accept order any more, please contact our partner Feitian online Store:
https://ftsafe.en.alibaba.com/index.html

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

JavaCard Applet Development Related Questions and Answers.
DaHuFa
Posts: 53
Joined: Mon Jun 04, 2018 5:07 am
Points :392
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: 35
Joined: Wed Jun 20, 2018 4:06 am
Points :218
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: 53
Joined: Mon Jun 04, 2018 5:07 am
Points :392
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: 86
Joined: Wed Nov 04, 2015 7:23 am
Points :656
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 66 guests

JavaCard OS : Disclaimer