@ThreadSafe public class ECDSAVerifier extends Object implements JWSVerifier, CriticalHeaderParamsAware
JWS objects. Expects a private EC key
(with a P-256, P-384 or P-521 curve).
See RFC 7518 section 3.4 for more information.
This class is thread-safe.
Supports the following algorithms:
| Modifier and Type | Field and Description |
|---|---|
static Set<JWSAlgorithm> |
SUPPORTED_ALGORITHMS
The supported JWS algorithms by the EC-DSA provider class.
|
| Constructor and Description |
|---|
ECDSAVerifier(ECKey ecJWK)
Creates a new Elliptic Curve Digital Signature Algorithm (ECDSA)
verifier.
|
ECDSAVerifier(ECPublicKey publicKey)
Creates a new Elliptic Curve Digital Signature Algorithm (ECDSA)
verifier.
|
ECDSAVerifier(ECPublicKey publicKey,
Set<String> defCritHeaders)
Creates a new Elliptic Curve Digital Signature Algorithm (ECDSA)
verifier.
|
| Modifier and Type | Method and Description |
|---|---|
Set<String> |
getDeferredCriticalHeaderParams()
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. |
JCAContext |
getJCAContext()
Returns the Java Cryptography Architecture (JCA) context.
|
Set<String> |
getProcessedCriticalHeaderParams()
Returns the names of the critical (
crit) header parameters
that are understood and processed by the JWS verifier / JWE
decrypter. |
ECPublicKey |
getPublicKey()
Returns the public EC key.
|
JWSAlgorithm |
supportedECDSAAlgorithm()
Returns the supported ECDSA algorithm.
|
Set<JWSAlgorithm> |
supportedJWSAlgorithms()
Returns the names of the supported algorithms by the JWS provider
instance.
|
boolean |
verify(JWSHeader header,
byte[] signedContent,
Base64URL signature)
Verifies the specified
signature of a
JWS object. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsupportedJWSAlgorithmsgetJCAContextpublic static final Set<JWSAlgorithm> SUPPORTED_ALGORITHMS
public ECDSAVerifier(ECPublicKey publicKey) throws JOSEException
publicKey - The public EC key. Must not be null.JOSEException - If the elliptic curve of key is not supported.public ECDSAVerifier(ECKey ecJWK) throws JOSEException
ecJWK - The EC JSON Web Key (JWK). Must not be null.JOSEException - If the elliptic curve of key is not supported.public ECDSAVerifier(ECPublicKey publicKey, Set<String> defCritHeaders) throws JOSEException
publicKey - The public EC 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.JOSEException - If the elliptic curve of key is not supported.public ECPublicKey getPublicKey()
public Set<String> getProcessedCriticalHeaderParams()
CriticalHeaderParamsAwarecrit) header parameters
that are understood and processed by the JWS verifier / JWE
decrypter.getProcessedCriticalHeaderParams in interface CriticalHeaderParamsAwarepublic Set<String> getDeferredCriticalHeaderParams()
CriticalHeaderParamsAwarecrit) header parameters
that are deferred to the application for processing and will be
ignored by the JWS verifier / JWE decrypter.getDeferredCriticalHeaderParams in interface CriticalHeaderParamsAwarepublic boolean verify(JWSHeader header, byte[] signedContent, Base64URL signature) throws JOSEException
JWSVerifiersignature of a
JWS object.verify in interface JWSVerifierheader - 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.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.JOSEException - If the JWS algorithm is not supported, or if
signature verification failed for some other
internal reason.public JWSAlgorithm supportedECDSAAlgorithm()
supportedECDSAAlgorithm()public Set<JWSAlgorithm> supportedJWSAlgorithms()
JWSProvideralg JWS header parameter.supportedJWSAlgorithms in interface JWSProviderpublic JCAContext getJCAContext()
JCAAwaregetJCAContext in interface JCAAware<JCAContext>null.Copyright © 2017 Connect2id Ltd.. All rights reserved.