Class RSASSAVerifier

    • Constructor Summary

      Constructors 
      Constructor Description
      RSASSAVerifier​(RSAKey rsaJWK)
      Creates a new RSA Signature-Scheme-with-Appendix (RSASSA) verifier.
      RSASSAVerifier​(java.security.interfaces.RSAPublicKey publicKey)
      Creates a new RSA Signature-Scheme-with-Appendix (RSASSA) verifier.
      RSASSAVerifier​(java.security.interfaces.RSAPublicKey publicKey, java.util.Set<java.lang.String> defCritHeaders)
      Creates a new RSA Signature-Scheme-with-Appendix (RSASSA) verifier.
    • Constructor Detail

      • RSASSAVerifier

        public RSASSAVerifier​(java.security.interfaces.RSAPublicKey publicKey)
        Creates a new RSA Signature-Scheme-with-Appendix (RSASSA) verifier.
        Parameters:
        publicKey - The public RSA key. Must not be null.
      • RSASSAVerifier

        public RSASSAVerifier​(RSAKey rsaJWK)
                       throws JOSEException
        Creates a new RSA Signature-Scheme-with-Appendix (RSASSA) verifier.
        Parameters:
        rsaJWK - The RSA JSON Web Key (JWK). Must not be null.
        Throws:
        JOSEException - If the RSA JWK extraction failed.
      • RSASSAVerifier

        public RSASSAVerifier​(java.security.interfaces.RSAPublicKey publicKey,
                              java.util.Set<java.lang.String> defCritHeaders)
        Creates a new RSA Signature-Scheme-with-Appendix (RSASSA) verifier.
        Parameters:
        publicKey - The public RSA key. Must not be null.
        defCritHeaders - The names of the critical header parameters that are deferred to the application for processing, empty set or null if none.
    • Method Detail

      • getPublicKey

        public java.security.interfaces.RSAPublicKey getPublicKey()
        Gets the public RSA key.
        Returns:
        The public RSA key.
      • getProcessedCriticalHeaderParams

        public java.util.Set<java.lang.String> getProcessedCriticalHeaderParams()
        Description copied from interface: CriticalHeaderParamsAware
        Returns the names of the critical (crit) header parameters that are understood and processed by the JWS verifier / JWE decrypter.
        Specified by:
        getProcessedCriticalHeaderParams in interface CriticalHeaderParamsAware
        Returns:
        The names of the critical header parameters that are understood and processed, empty set if none.
      • getDeferredCriticalHeaderParams

        public java.util.Set<java.lang.String> getDeferredCriticalHeaderParams()
        Description copied from interface: CriticalHeaderParamsAware
        Returns the names of the critical (crit) header parameters that are deferred to the application for processing and will be ignored by the JWS verifier / JWE decrypter.
        Specified by:
        getDeferredCriticalHeaderParams in interface CriticalHeaderParamsAware
        Returns:
        The names of the critical header parameters that are deferred to the application for processing, empty set if none.
      • verify

        public boolean verify​(JWSHeader header,
                              byte[] signedContent,
                              Base64URL signature)
                       throws JOSEException
        Description copied from interface: JWSVerifier
        Verifies the specified signature of a JWS object.
        Specified by:
        verify in interface JWSVerifier
        Parameters:
        header - The JSON Web Signature (JWS) header. Must specify a supported JWS algorithm and must not be null.
        signedContent - The signing input. Must not be null.
        signature - The signature part of the JWS object. Must not be null.
        Returns:
        true if the signature was successfully verified, false if the signature is invalid or if a critical header is neither supported nor marked for deferral to the application.
        Throws:
        JOSEException - If the JWS algorithm is not supported, or if signature verification failed for some other internal reason.