@ThreadSafe public class RSASSASigner extends Object implements JWSSigner
JWS objects. Expects a private RSA key.
See RFC 7518, sections 3.3 and 3.5 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 RSA-SSA provider class.
|
| Constructor and Description |
|---|
RSASSASigner(PrivateKey privateKey)
Creates a new RSA Signature-Scheme-with-Appendix (RSASSA) signer.
|
RSASSASigner(RSAKey rsaJWK)
Creates a new RSA Signature-Scheme-with-Appendix (RSASSA) signer.
|
| Modifier and Type | Method and Description |
|---|---|
JCAContext |
getJCAContext()
Returns the Java Cryptography Architecture (JCA) context.
|
PrivateKey |
getPrivateKey()
Gets the private RSA key.
|
Base64URL |
sign(JWSHeader header,
byte[] signingInput)
Signs the specified
input of a
JWS object. |
Set<JWSAlgorithm> |
supportedJWSAlgorithms()
Returns the names of the supported algorithms by the JWS provider
instance.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsupportedJWSAlgorithmsgetJCAContextpublic static final Set<JWSAlgorithm> SUPPORTED_ALGORITHMS
public RSASSASigner(PrivateKey privateKey)
privateKey - The private RSA key. Its algorithm must be "RSA".
Must not be null.public RSASSASigner(RSAKey rsaJWK) throws JOSEException
rsaJWK - The RSA JSON Web Key (JWK). Must contain or reference
a private part. Must not be null.JOSEException - If the RSA JWK doesn't contain a private part
or its extraction failed.public PrivateKey getPrivateKey()
RSAPrivateKey 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.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.