@ThreadSafe public class ECDSASigner extends java.lang.Object implements JWSSigner
JWS objects
. This class is thread-safe.
Supports the following JSON Web Algorithms (JWAs):
Modifier and Type | Field and Description |
---|---|
protected java.security.Provider |
provider
The underlying cryptographic provider,
null if not specified
(implies default one). |
static java.util.Set<JWSAlgorithm> |
SUPPORTED_ALGORITHMS
The supported JWS algorithms.
|
Constructor and Description |
---|
ECDSASigner(java.math.BigInteger privateKey)
Creates a new Elliptic Curve Digital Signature Algorithm (ECDSA)
signer.
|
Modifier and Type | Method and Description |
---|---|
protected static com.nimbusds.jose.crypto.ECDSAParameters |
getECDSAParameters(JWSAlgorithm alg)
Gets the initial parameters for the specified ECDSA-based JSON Web
Algorithm (JWA).
|
java.math.BigInteger |
getPrivateKey()
Gets the private key ('d' parameter).
|
protected static int |
getSignatureByteArrayLength(JWSAlgorithm alg)
Gets the expected signature byte array length (R + S parts) for the
specified ECDSA algorithm.
|
void |
setProvider(java.security.Provider provider)
Sets a specific JCA provider, to be used for all operations.
|
Base64URL |
sign(JWSHeader header,
byte[] signingInput)
Signs the specified
input of a
JWS object . |
java.util.Set<JWSAlgorithm> |
supportedAlgorithms()
Returns the names of the supported JWS algorithms.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
supportedAlgorithms
setProvider
public static final java.util.Set<JWSAlgorithm> SUPPORTED_ALGORITHMS
protected java.security.Provider provider
null
if not specified
(implies default one).public ECDSASigner(java.math.BigInteger privateKey)
privateKey
- The private key ('d' parameter). Must not be
null
.public java.math.BigInteger getPrivateKey()
public Base64URL sign(JWSHeader header, byte[] signingInput) throws JOSEException
JWSSigner
input
of a
JWS object
.sign
in interface JWSSigner
header
- 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 or if
signing failed for some other reason.protected static int getSignatureByteArrayLength(JWSAlgorithm alg) throws JOSEException
alg
- The JSON Web Algorithm (JWA). Must be supported and not
null
.JOSEException
- If the algorithm is not supported.protected static com.nimbusds.jose.crypto.ECDSAParameters getECDSAParameters(JWSAlgorithm alg) throws JOSEException
alg
- The JSON Web Algorithm (JWA). Must be supported and not
null
.JOSEException
- If the algorithm is not supported.public java.util.Set<JWSAlgorithm> supportedAlgorithms()
JWSAlgorithmProvider
alg
JWS header parameter.supportedAlgorithms
in interface JWSAlgorithmProvider
public void setProvider(java.security.Provider provider)
AlgorithmProvider
setProvider
in interface AlgorithmProvider
provider
- The JCA provider, or null
to use the default
one.Copyright © 2014 Connect2id Ltd.. All Rights Reserved.