Wednesday, October 28, 2009

Elliptic Curve Interfaces
















































Elliptic Curve Interfaces


The interfaces representing elliptic curve keys are in the package org.bouncycastle.jce.interfaces. Although most of them are no longer relevant when you move to JDK 1.5, the ECPointEncoder interface is still useful if you need to work with other providers that cannot handle points encoded in compressed format.




The ECKey Interface


The ECKey interface has a single method, getParameters(), which returns an ECParameterSpec representing the domain parameters for the elliptic curve the key is associated with.





The ECPrivateKey Interface



The ECPrivateKey interface has a single method, getD(), which returns a BigInteger representing the private value for the elliptic curve private key.





The ECPublicKey Interface


The ECPublicKey interface has a single method, getQ(), which returns the ECPoint representing the public point for the elliptic curve public key.





The ECPointEncoder Interface


All Bouncy Castle elliptic curve keys implement this interface, even after JDK 1.5.


The ECPointEncoder interface has a single method, setPointFormat(), which takes a string representing the style of encoding you want to use when the EC key implementing this interface has its getEncoded() method called.


By default, Bouncy Castle elliptic curve keys
encode using point compression. This can cause problems with other
providers that do not support it. If you pass UNCOMPRESSED to the setPointFormat() method, points will be encoded uncompressed.








































No comments: