Interface JWAAlgorithm<A extends JWK>

Type Parameters:
A - the type of key
All Known Implementing Classes:
ECAlgorithm, EdECAlgorithm, NoAlgorithm, OCTAlgorithm, PBES2Algorithm, RSAAlgorithm, XECAlgorithm

public interface JWAAlgorithm<A extends JWK>

Base JWA algorithm as specified by RFC7518.

Since:
1.5
Author:
Jeremy Kuhn
  • Method Details

    • getAlgorithm

      String getAlgorithm()

      Returns the JWA registered name of the algorithm.

      Returns:
      a JWA registered name
    • isSignature

      boolean isSignature()

      Determines whether the algorithm is a signature algorithm.

      Returns:
      true if the algorithm is a signature algorithm, false otherwise
    • isKeyManagement

      boolean isKeyManagement()

      Determines whether the algorithm is a key management algorithm.

      Returns:
      true if the algorithm is a key management algorithm, false otherwise
    • isEncryption

      boolean isEncryption()

      Determines whether the algorithm is an encryption algorithm.

      Returns:
      true if the algorithm is an encryption algorithm, false otherwise
    • createSigner

      JWASigner createSigner(A jwk) throws JWAProcessingException

      Creates a signer from the algorithm.

      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

      JWAKeyManager createKeyManager(A jwk) throws JWAProcessingException

      Creates a key manager from the algorithm.

      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

      JWACipher createCipher(A jwk) throws JWAProcessingException

      Creates a cipher from the algorithm.

      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