@ThreadSafe public class MACSigner 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 |
|---|
MACSigner(byte[] sharedSecret)
Creates a new Message Authentication (MAC) signer.
|
MACSigner(java.lang.String sharedSecretString)
Creates a new Message Authentication (MAC) signer.
|
| Modifier and Type | Method and Description |
|---|---|
protected static java.lang.String |
getJCAAlgorithmName(JWSAlgorithm alg)
Gets the matching Java Cryptography Architecture (JCA) algorithm
name for the specified HMAC-based JSON Web Algorithm (JWA).
|
byte[] |
getSharedSecret()
Gets the shared secret.
|
java.lang.String |
getSharedSecretString()
Gets the shared secret as a UTF-8 encoded string.
|
void |
setProvider(java.security.Provider provider)
Sets a specific JCA provider, to be used for all operations.
|
Base64URL |
sign(ReadOnlyJWSHeader 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, waitsupportedAlgorithmssetProviderpublic static final java.util.Set<JWSAlgorithm> SUPPORTED_ALGORITHMS
protected java.security.Provider provider
null if not specified
(implies default one).public MACSigner(byte[] sharedSecret)
sharedSecret - The shared secret. Must not be null.public MACSigner(java.lang.String sharedSecretString)
sharedSecretString - The shared secret as a UTF-8 encoded
string. Must not be null.public Base64URL sign(ReadOnlyJWSHeader 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 or if
signing failed for some other reason.protected static java.lang.String getJCAAlgorithmName(JWSAlgorithm alg) throws JOSEException
alg - The JSON Web Algorithm (JWA). Must be supported and not
null.JOSEException - If the algorithm is not supported.public byte[] getSharedSecret()
public java.lang.String getSharedSecretString()
public java.util.Set<JWSAlgorithm> supportedAlgorithms()
JWSAlgorithmProvideralg JWS header parameter.supportedAlgorithms in interface JWSAlgorithmProviderpublic void setProvider(java.security.Provider provider)
AlgorithmProvidersetProvider in interface AlgorithmProviderprovider - The JCA provider, or null to use the default
one.Copyright © 2014 Connect2id Ltd.. All Rights Reserved.