@ThreadSafe public class ECDSASigner extends ECDSAProvider implements JWSSigner
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:
SUPPORTED_ALGORITHMS| Constructor and Description |
|---|
ECDSASigner(ECKey ecJWK)
Creates a new Elliptic Curve Digital Signature Algorithm (ECDSA)
signer.
|
ECDSASigner(ECPrivateKey privateKey)
Creates a new Elliptic Curve Digital Signature Algorithm (ECDSA)
signer.
|
ECDSASigner(PrivateKey privateKey,
Curve curve)
Creates a new Elliptic Curve Digital Signature Algorithm (ECDSA)
signer.
|
| Modifier and Type | Method and Description |
|---|---|
PrivateKey |
getPrivateKey()
Gets the private EC key.
|
Base64URL |
sign(JWSHeader header,
byte[] signingInput)
Signs the specified
input of a
JWS object. |
supportedECDSAAlgorithmgetJCAContext, supportedJWSAlgorithmsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsupportedJWSAlgorithmsgetJCAContextpublic ECDSASigner(ECPrivateKey privateKey) throws JOSEException
privateKey - The private EC key. Must not be null.JOSEException - If the elliptic curve of key is not supported.public ECDSASigner(PrivateKey privateKey, Curve curve) throws JOSEException
privateKey - The private EC key. Its algorithm must be "EC".
Must not be null.curve - The elliptic curve for the key. Must not be
null.JOSEException - If the elliptic curve of key is not supported.public ECDSASigner(ECKey ecJWK) throws JOSEException
ecJWK - The EC JSON Web Key (JWK). Must contain a private part.
Must not be null.JOSEException - If the EC JWK doesn't contain a private part,
its extraction failed, or the elliptic curve
is not supported.public PrivateKey getPrivateKey()
ECPrivateKey may not be
possible if the key is located in a PKCS#11 store that
doesn't expose the private key parameters.public Base64URL sign(JWSHeader header, byte[] signingInput) throws JOSEException
JWSSignerinput of a
JWS object.sign in interface JWSSignerheader - The JSON Web Signature (JWS) header. Must
specify a supported JWS algorithm and must not
be null.signingInput - The input to sign. Must not be null.JOSEException - If the JWS algorithm is not supported, if a
critical header parameter is not supported or
marked for deferral to the application, or if
signing failed for some other internal reason.Copyright © 2021 Connect2id Ltd.. All rights reserved.