简体   繁体   中英

Computing ECC public key from a private key in JavaCard

With Java Card APIs, which "support" Elliptic curves, how do I compute a public key given a known secret key.

Following a DH shared secret negotiation I'm interested in deriving common shared keys. According to TR-03111 and X9.63 the shared secret from the DH ECC key agreement should not be used but, according to my understanding, the affine representation of the x-coordinate (The x component of the public key associated with the shared secret as a private key) is to be used.

With BigInteger arithmetic or ECPoint.multiply() this easy, but no such APIs exist in Java Card.

This multiplication isn't directly available for Java Card. Basically Java Card hides low level operations for you.

However, if you have a relatively new Java Card you may get away with this by using a KeyAgreement instance created using ALG_EC_SVDP_DH_PLAIN_XY . What you can do is to create a ECPublicKey where the public key point is simply set to point G. This base point G is part of the domain parameters. The private key should of course be set to your value.

Then all it comes down to is to perform a key agreement; the result of the agreement will be the points X and Y of the public key.


Note that support of any algorithm constant depends on the card implementation. The constant will be there - if the implemented API is new enough - but the algorithm may not be implemented.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM