Class RSAVerifier

java.lang.Object
io.fusionauth.jwt.rsa.RSAVerifier
All Implemented Interfaces:
Verifier

public class RSAVerifier extends Object implements Verifier
This class is used to verify a JWT with an RSA signature using an RSA Public Key.
Author:
Daniel DeGroff
  • Method Details

    • newVerifier

      public static RSAVerifier newVerifier(PublicKey publicKey)
      Return a new instance of the RSA Verifier with the provided public key.
      Parameters:
      publicKey - The RSA public key object.
      Returns:
      a new instance of the RSA verifier.
    • newVerifier

      public static RSAVerifier newVerifier(PublicKey publicKey, CryptoProvider cryptoProvider)
      Return a new instance of the RSA Verifier with the provided public key.
      Parameters:
      publicKey - The RSA public key object.
      cryptoProvider - The crypto provider used to get the RSA signature Algorithm.
      Returns:
      a new instance of the RSA verifier.
    • newVerifier

      public static RSAVerifier newVerifier(String publicKey)
      Return a new instance of the RSA Verifier with the provided public key.
      Parameters:
      publicKey - The RSA public key PEM.
      Returns:
      a new instance of the RSA verifier.
    • newVerifier

      public static RSAVerifier newVerifier(String publicKey, CryptoProvider cryptoProvider)
      Return a new instance of the RSA Verifier with the provided public key.
      Parameters:
      publicKey - The RSA public key PEM.
      cryptoProvider - The crypto provider used to get the RSA signature Algorithm.
      Returns:
      a new instance of the RSA verifier.
    • newVerifier

      public static RSAVerifier newVerifier(Path path)
      Return a new instance of the RSA Verifier with the provided public key.
      Parameters:
      path - The path to the RSA public key PEM.
      Returns:
      a new instance of the RSA verifier.
    • newVerifier

      public static RSAVerifier newVerifier(Path path, CryptoProvider cryptoProvider)
      Return a new instance of the RSA Verifier with the provided public key.
      Parameters:
      path - The path to the RSA public key PEM.
      cryptoProvider - The crypto provider used to get the RSA signature Algorithm.
      Returns:
      a new instance of the RSA verifier.
    • newVerifier

      public static RSAVerifier newVerifier(byte[] bytes)
      Return a new instance of the RSA Verifier with the provided public key.
      Parameters:
      bytes - The bytes of the RSA public key PEM.
      Returns:
      a new instance of the RSA verifier.
    • canVerify

      public boolean canVerify(Algorithm algorithm)
      Specified by:
      canVerify in interface Verifier
      Parameters:
      algorithm - The algorithm required to verify the signature on this JWT.
      Returns:
      True if this Verifier is able to verify a signature using the specified algorithm.
    • verify

      public void verify(Algorithm algorithm, byte[] message, byte[] signature)
      Description copied from interface: Verifier
      Verify the signature of the encoded JWT payload.
      Specified by:
      verify in interface Verifier
      Parameters:
      algorithm - The algorithm used to verify the JWT signature.
      message - The JWT message. The header and claims, the first two segments of the dot separated JWT.
      signature - The signature to verify.