java.lang.Object
java.lang.Enum<ECCurve>
io.inverno.mod.security.jose.jwa.ECCurve
All Implemented Interfaces:
Serializable, Comparable<ECCurve>, Constable

public enum ECCurve extends Enum<ECCurve>

Elliptic Curves as defined by RFC7518.

Supported curves:

  • P-256
  • P-384
  • P-521
  • secp256k1 (deprecated)
Since:
1.5
Author:
Jeremy Kuhn
  • Enum Constant Details

  • Method Details

    • values

      public static ECCurve[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ECCurve valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getCurve

      public String getCurve()

      Returns the JWA registered curve name.

      Returns:
      the registered name of the curve
    • getJCAName

      public String getJCAName()

      Returns the JCA curve name.

      Returns:
      the JCA curve name
    • getFieldSize

      public int getFieldSize()

      Returns the field size in bits.

      Returns:
      the field size in bits
    • getKeyLength

      public int getKeyLength()

      Returns the key length in bytes.

      Returns:
      the key length in bytes
    • getSignatureLength

      public int getSignatureLength()

      Returns the signature length in bytes.

      Returns:
      the signature length in bytes
    • getParameterSpec

      Returns the Elliptic curve parameters.

      Returns:
      the Elliptic curve parameters
      Throws:
      JWAProcessingException - if the curve is not fully supported
      IllegalStateException - if there was an error creating the parameters
    • isOnCurve

      public boolean isOnCurve(BigInteger x, BigInteger y)

      Determines whether the specified point is on the curve.

      Parameters:
      x - the x coordinate
      y - the y coordinate
      Returns:
      true if the point is on the curve, false otherwise
    • fromCurve

      public static ECCurve fromCurve(String crv) throws IllegalArgumentException

      Returns the curve corresponding to the specified JWA registered curve name.

      Parameters:
      crv - a JWA registered curve name
      Returns:
      an Elliptic curve
      Throws:
      IllegalArgumentException - if the specified curve is not supported