Class ECPublicKeyNamedCurveSpec

  • All Implemented Interfaces:
    KeySpec

    public class ECPublicKeyNamedCurveSpec
    extends java.lang.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 Summary

      Constructors 
      Constructor Description
      ECPublicKeyNamedCurveSpec​(java.lang.String curveName, byte[] x, byte[] y)
      Creates a new ECPublicKeyNamedCurveSpec with the specified parameter values.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getCurveName()
      Returns the elliptic curve name.
      byte[] getX()
      Returns the affine x-coordinate of the associated point.
      byte[] getY()
      Returns the affine y-coordinate of the associated point.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ECPublicKeyNamedCurveSpec

        public ECPublicKeyNamedCurveSpec​(java.lang.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 java.lang.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.