Class ECPublicKeyNamedCurveSpec

  • All Implemented Interfaces:
    KeySpec

    public class ECPublicKeyNamedCurveSpec
    extends Object
    implements KeySpec
    This class specifies an elliptic curve public key based on the name of the curve used and the affine coordinates of the associated point on the curve.

    To generate a key using this spec:

     
     String curveName = "secp256r1";
     BigInteger x = ...
     BigInteger y = ...
     ECPublicKeyNamedCurveSpec keySpec = new ECPublicKeyNamedCurveSpec(curveName, x.toByteArray(), y.toByteArray());
     PublicKey ecPublicKey = KeyFactory.getInstance("EC").generatePublic(keySpec);
     
     
    See Also:
    KeyFactory
    • Constructor Detail

      • ECPublicKeyNamedCurveSpec

        public ECPublicKeyNamedCurveSpec​(String curveName,
                                         byte[] x,
                                         byte[] y)
        Creates a new ECPublicKeyNamedCurveSpec with the specified parameter values.
        Parameters:
        curveName - the name of the elliptic curve.
        x - the affine x-coordinate of the associated point.
        y - the affine y-coordinate of the associated point.
    • Method Detail

      • getCurveName

        public String getCurveName()
        Returns the elliptic curve name.
        Returns:
        the elliptic curve name.
      • getX

        public byte[] getX()
        Returns the affine x-coordinate of the associated point.
        Returns:
        the affine x-coordinate of the associated point.
      • getY

        public byte[] getY()
        Returns the affine y-coordinate of the associated point.
        Returns:
        the affine y-coordinate of the associated point.