Class JoseHttpVerifier

java.lang.Object
com.authlete.hms.impl.JoseHttpVerifier
All Implemented Interfaces:
HttpVerifier

public class JoseHttpVerifier extends Object implements HttpVerifier
An HttpVerifier implementation for JWS algorithms.
See Also:
  • Constructor Details

    • JoseHttpVerifier

      public JoseHttpVerifier(JWK key)
      A constructor with a key for verification.

      An algorithm needs to be specified by the alg parameter in the JWK.

      Parameters:
      key - A verification key.
      Throws:
      IllegalArgumentException - The key is null, or it does not contain the alg parameter.
    • JoseHttpVerifier

      public JoseHttpVerifier(JWK key, JWSAlgorithm alg)
      A constructor with a key and algorithm for verification.

      An algorithm needs to be specified by either the alg argument passed to this method or the alg parameter in the JWK. When both means are used, the specified algorithms must be identical.

      Parameters:
      key - A verification key.
      alg - An algorithm for verification.
      Throws:
      IllegalArgumentException - The key is null, or the alg parameter of the key does not match the algorithm specified by the alg argument. Or, the key does not contain the alg parameter and the alg argument is null.
  • Method Details

    • verify

      public boolean verify(byte[] signatureBase, byte[] signature) throws SignatureException
      Description copied from interface: HttpVerifier
      Verify the signature.
      Specified by:
      verify in interface HttpVerifier
      Parameters:
      signatureBase - The signature base used to create the signature.
      signature - The signature to be verified.
      Returns:
      True when the signature is valid.
      Throws:
      SignatureException - An error occurred during the verification process, or the signature is invalid.
    • getKey

      public JWK getKey()
      Get the key.
      Returns:
      The key.
    • getAlg

      public JWSAlgorithm getAlg()
      Get the algorithm.
      Returns:
      The algorithm.