Enum Class EdECAlgorithm

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

public enum EdECAlgorithm extends Enum<EdECAlgorithm> implements JWAAlgorithm<EdECJWK>

Edward-curve digital signature algorithms as defined by RFC8037 Section 3.1.

Signature algorithms:

  • EdDSA with Ed25519 curve
  • EdDSA with Ed448 curve

These algorithms are bound to the following Elliptic curves respectively: OKPCurve.ED25519 and OKPCurve.ED448.

Since:
1.5
Author:
Jeremy Kuhn
  • Enum Constant Details

  • Method Details

    • values

      public static EdECAlgorithm[] 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 EdECAlgorithm 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
    • getAlgorithm

      public String getAlgorithm()
      Description copied from interface: JWAAlgorithm

      Returns the JWA registered name of the algorithm.

      Specified by:
      getAlgorithm in interface JWAAlgorithm<EdECJWK>
      Returns:
      a JWA registered name
    • isSignature

      public boolean isSignature()
      Description copied from interface: JWAAlgorithm

      Determines whether the algorithm is a signature algorithm.

      Specified by:
      isSignature in interface JWAAlgorithm<EdECJWK>
      Returns:
      true if the algorithm is a signature algorithm, false otherwise
    • isKeyManagement

      public boolean isKeyManagement()
      Description copied from interface: JWAAlgorithm

      Determines whether the algorithm is a key management algorithm.

      Specified by:
      isKeyManagement in interface JWAAlgorithm<EdECJWK>
      Returns:
      true if the algorithm is a key management algorithm, false otherwise
    • isEncryption

      public boolean isEncryption()
      Description copied from interface: JWAAlgorithm

      Determines whether the algorithm is an encryption algorithm.

      Specified by:
      isEncryption in interface JWAAlgorithm<EdECJWK>
      Returns:
      true if the algorithm is an encryption algorithm, false otherwise
    • createSigner

      public JWASigner createSigner(EdECJWK jwk) throws JWAProcessingException
      Description copied from interface: JWAAlgorithm

      Creates a signer from the algorithm.

      Specified by:
      createSigner in interface JWAAlgorithm<EdECJWK>
      Parameters:
      jwk - the key to use for signing
      Returns:
      a JWA signer
      Throws:
      JWAProcessingException - if the algorithm is not a signature algorithm or if there was an error creating the signer
    • createKeyManager

      public JWAKeyManager createKeyManager(EdECJWK jwk) throws JWAProcessingException
      Description copied from interface: JWAAlgorithm

      Creates a key manager from the algorithm.

      Specified by:
      createKeyManager in interface JWAAlgorithm<EdECJWK>
      Parameters:
      jwk - the key to use for signing
      Returns:
      a JWA key manager
      Throws:
      JWAProcessingException - if the algorithm is not a key management algorithm or if there was an error creating the key manager
    • createCipher

      public JWACipher createCipher(EdECJWK jwk) throws JWAProcessingException
      Description copied from interface: JWAAlgorithm

      Creates a cipher from the algorithm.

      Specified by:
      createCipher in interface JWAAlgorithm<EdECJWK>
      Parameters:
      jwk - the key to use for signing
      Returns:
      a JWA cipher
      Throws:
      JWAProcessingException - if the algorithm is not an encryption algorithm or if there was an error creating the cipher
    • getJcaAlgorithm

      public String getJcaAlgorithm()

      Return the JCA algorithm corresponding to the JWA algorithm.

      Returns:
      a JCA algorithm name
    • getCurve

      public OKPCurve getCurve()

      Returns the Octet Key Pair curve bound to the algorithm.

      Returns:
      an Octet Key Pair curve
    • fromAlgorithm

      public static EdECAlgorithm fromAlgorithm(String alg, OKPCurve curve) throws IllegalArgumentException

      Returns the Edward-curve digital Signature algorithm corresponding to the specified JWA registered algorithm name and Octet Key Pair curve.

      Parameters:
      alg - a JWA registered algorithm name
      curve - the corresponding OKP curve
      Returns:
      an Edward-curve digital Signature algorithm
      Throws:
      IllegalArgumentException - if the specified algorithm is not an EdEC algorithm or if the curve does not correspond to the algorithm