Reputation: 21
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.
Upvotes: 2
Views: 1007
Reputation: 94058
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.
Upvotes: 1