|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.nimbusds.jose.crypto.MACVerifier
@ThreadSafe public class MACVerifier
Message Authentication Code (MAC) verifier of
JWS objects. This class is thread-safe.
Supports the following JSON Web Algorithms (JWAs):
Accepts the following JWS header parameters:
alg
typ
cty
| Constructor Summary | |
|---|---|
MACVerifier(byte[] sharedSecret)
Creates a new Message Authentication (MAC) verifier. |
|
| Method Summary | |
|---|---|
JWSHeaderFilter |
getJWSHeaderFilter()
Gets the JWS header filter associated with the verifier. |
protected static Mac |
getMAC(JWSAlgorithm alg)
Gets a Message Authentication Code (MAC) service for the specified HMAC-based JSON Web Algorithm (JWA). |
byte[] |
getSharedSecret()
Gets the shared secret. |
Set<JWSAlgorithm> |
supportedAlgorithms()
Returns the names of the supported JWS algorithms. |
boolean |
verify(ReadOnlyJWSHeader header,
byte[] signedContent,
Base64URL signature)
Verifies the specified signature of a
JWS object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.nimbusds.jose.JWSAlgorithmProvider |
|---|
supportedAlgorithms |
| Constructor Detail |
|---|
public MACVerifier(byte[] sharedSecret)
sharedSecret - The shared secret. Must not be null.| Method Detail |
|---|
public JWSHeaderFilter getJWSHeaderFilter()
JWSVerifiersupported JWS algorithms and
header parameters that the verifier is configured to accept.
Attempting to verify a JWS object signature with an
algorithm or header parameter that is not accepted must result in a
JOSEException.
getJWSHeaderFilter in interface JWSVerifier
public boolean verify(ReadOnlyJWSHeader header,
byte[] signedContent,
Base64URL signature)
throws JOSEException
JWSVerifiersignature of a
JWS object.
verify in interface JWSVerifierheader - The JSON Web Signature (JWS) header. Must
specify an accepted JWS algorithm, must contain
only accepted header parameters, and must not be
null.signedContent - The signed content. 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.public byte[] getSharedSecret()
protected static Mac getMAC(JWSAlgorithm alg)
throws JOSEException
alg - The JSON Web Algorithm (JWA). Must be supported and not
null.
JOSEException - If the algorithm is not supported.public Set<JWSAlgorithm> supportedAlgorithms()
JWSAlgorithmProvideralg JWS header parameter.
supportedAlgorithms in interface JWSAlgorithmProvider
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||