public interface JWSVerifier extends JWSAlgorithmProvider
Callers can query the verifier to determine its algorithm capabilities as well as the JWS algorithms and header parameters that are accepted for processing.
Modifier and Type | Method and Description |
---|---|
java.util.Set<JWSAlgorithm> |
getAcceptedAlgorithms()
Gets the names of the accepted JWS algorithms.
|
java.util.Set<java.lang.String> |
getIgnoredCriticalHeaderParameters()
Gets the names of the critical JWS header parameters to ignore.
|
void |
setAcceptedAlgorithms(java.util.Set<JWSAlgorithm> acceptedAlgs)
Sets the names of the accepted JWS algorithms.
|
void |
setIgnoredCriticalHeaderParameters(java.util.Set<java.lang.String> headers)
Sets the names of the critical JWS header parameters to ignore.
|
boolean |
verify(JWSHeader header,
byte[] signingInput,
Base64URL signature)
Verifies the specified
signature of a
JWS object . |
supportedAlgorithms
setProvider
java.util.Set<JWSAlgorithm> getAcceptedAlgorithms()
alg
JWS header parameter.setAcceptedAlgorithms(java.util.Set<com.nimbusds.jose.JWSAlgorithm>)
void setAcceptedAlgorithms(java.util.Set<JWSAlgorithm> acceptedAlgs)
alg
JWS header parameter.
For JWS verifiers that support multiple JWS algorithms this method can be used to indicate that only a subset should be accepted for processing.
acceptedAlgs
- The accepted JWS algorithms. Must be a subset of
the supported algorithms and not null
.java.util.Set<java.lang.String> getIgnoredCriticalHeaderParameters()
crit
header parameter. The JWS
verifier should not ignore critical headers by default.null
if none.void setIgnoredCriticalHeaderParameters(java.util.Set<java.lang.String> headers)
crit
header parameter. The JWS
verifier should not ignore critical headers by default. Use this
setter to delegate processing of selected critical headers to the
application.headers
- The names of the critical JWS header parameters to
ignore, empty or null
if none.boolean verify(JWSHeader header, byte[] signingInput, Base64URL signature) throws JOSEException
signature
of a
JWS object
.header
- The JSON Web Signature (JWS) header. Must
specify an accepted JWS algorithm, must contain
only accepted header parameters, and must not be
null
.signingInput
- The signing input. Must not be null
.signature
- The signature part of the JWS object. Must not
be null
.true
if the signature was successfully verified,
else false
.JOSEException
- If the JWS algorithm is not accepted, if a
header parameter is not accepted, or if
signature verification failed for some other
reason.Copyright © 2014 Connect2id Ltd.. All Rights Reserved.