Page 1 of 1

Question about the ECDH

Posted: Sun Jul 08, 2018 3:13 am
by iSmartcard
Hello everyone, when I use the bouncycastle encryption library, I get a question about ECDH. With ECDH, the length of the value is 32 bytes and the length of the javacard is 20 bytes. What happened? Does anyone know why?

Re: Question about the ECDH

Posted: Mon Jul 09, 2018 5:43 am
by AlexLiu
32 bytes corresponding to ECC256, ECDH protocol based on ecc curve 256 bit,
20 bytes corresponding to ECC160, ECDH protocol based on ecc curve 160 bit

Re: Question about the ECDH

Posted: Mon Jul 09, 2018 6:07 am
by scplatform
According the API specification of jc304 or above, the result will be hash with SHA1.
ALG_EC_SVDP_DH
public static final byte ALG_EC_SVDP_DH
Elliptic curve secret value derivation primitive, Diffie-Hellman version, as per [IEEE P1363].
Note:

This algorithm computes the SHA-1 message digest of the output of the derivation primitive to yield a 20 byte result.
See Also:
Constant Field Values

Re: Question about the ECDH

Posted: Fri Jul 13, 2018 5:21 am
by happy123654
there will have SHA_1 calculation in the last step of ECDH and the result of SHA_1 is 20 bytes