Package com.nimbusds.jose.crypto
Class RSASSAVerifier
java.lang.Object
com.nimbusds.jose.crypto.impl.BaseJWSProvider
com.nimbusds.jose.crypto.impl.RSASSAProvider
com.nimbusds.jose.crypto.RSASSAVerifier
- All Implemented Interfaces:
CriticalHeaderParamsAware,JCAAware<JCAContext>,JOSEProvider,JWSProvider,JWSVerifier
@ThreadSafe
public class RSASSAVerifier
extends RSASSAProvider
implements JWSVerifier, CriticalHeaderParamsAware
RSA Signature-Scheme-with-Appendix (RSASSA) verifier of
JWS objects. Expects a public RSA key.
See RFC 7518, sections 3.3 and 3.5 for more information.
This class is thread-safe.
Supports the following algorithms:
JWSAlgorithm.RS256JWSAlgorithm.RS384JWSAlgorithm.RS512JWSAlgorithm.PS256JWSAlgorithm.PS384JWSAlgorithm.PS512
Supports the
BouncyCastle FIPS provider for the PSxxx family of JWS algorithms.
- Version:
- 2015-06-02
- Author:
- Vladimir Dzhuvinov
-
Field Summary
Fields inherited from class com.nimbusds.jose.crypto.impl.RSASSAProvider
SUPPORTED_ALGORITHMS -
Constructor Summary
ConstructorsConstructorDescriptionRSASSAVerifier(RSAKey rsaJWK) Creates a new RSA Signature-Scheme-with-Appendix (RSASSA) verifier.RSASSAVerifier(RSAPublicKey publicKey) Creates a new RSA Signature-Scheme-with-Appendix (RSASSA) verifier.RSASSAVerifier(RSAPublicKey publicKey, Set<String> defCritHeaders) Creates a new RSA Signature-Scheme-with-Appendix (RSASSA) verifier. -
Method Summary
Modifier and TypeMethodDescriptionReturns 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.Returns the names of the critical (crit) header parameters that are understood and processed by the JWS verifier / JWE decrypter.Gets the public RSA key.booleanVerifies the specifiedsignatureof aJWS object.Methods inherited from class com.nimbusds.jose.crypto.impl.BaseJWSProvider
getJCAContext, supportedJWSAlgorithmsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.nimbusds.jose.jca.JCAAware
getJCAContextMethods inherited from interface com.nimbusds.jose.JWSProvider
supportedJWSAlgorithms
-
Constructor Details
-
RSASSAVerifier
Creates a new RSA Signature-Scheme-with-Appendix (RSASSA) verifier.- Parameters:
publicKey- The public RSA key. Must not benull.
-
RSASSAVerifier
Creates a new RSA Signature-Scheme-with-Appendix (RSASSA) verifier.- Parameters:
rsaJWK- The RSA JSON Web Key (JWK). Must not benull.- Throws:
JOSEException- If the RSA JWK extraction failed.
-
RSASSAVerifier
Creates a new RSA Signature-Scheme-with-Appendix (RSASSA) verifier.- Parameters:
publicKey- The public RSA key. Must not benull.defCritHeaders- The names of the critical header parameters that are deferred to the application for processing, empty set ornullif none.
-
-
Method Details
-
getPublicKey
Gets the public RSA key.- Returns:
- The public RSA key.
-
getProcessedCriticalHeaderParams
Description copied from interface:CriticalHeaderParamsAwareReturns the names of the critical (crit) header parameters that are understood and processed by the JWS verifier / JWE decrypter.- Specified by:
getProcessedCriticalHeaderParamsin interfaceCriticalHeaderParamsAware- Returns:
- The names of the critical header parameters that are understood and processed, empty set if none.
-
getDeferredCriticalHeaderParams
Description copied from interface:CriticalHeaderParamsAwareReturns 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:
getDeferredCriticalHeaderParamsin interfaceCriticalHeaderParamsAware- 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:JWSVerifierVerifies the specifiedsignatureof aJWS object.- Specified by:
verifyin interfaceJWSVerifier- Parameters:
header- The JSON Web Signature (JWS) header. Must specify a supported JWS algorithm and must not benull.signedContent- The signing input. Must not benull.signature- The signature part of the JWS object. Must not benull.- Returns:
trueif the signature was successfully verified,falseif 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.
-