com.nimbusds.jose.crypto
Class RSASSASigner

java.lang.Object
  extended by com.nimbusds.jose.crypto.RSASSASigner
All Implemented Interfaces:
JWSAlgorithmProvider, JWSSigner

@ThreadSafe
public class RSASSASigner
extends Object
implements JWSSigner

RSA Signature-Scheme-with-Appendix (RSASSA) signer of JWS objects. This class is thread-safe.

Supports the following JSON Web Algorithms (JWAs):

Version:
$version$ (2013-05-04)
Author:
Vladimir Dzhuvinov

Field Summary
static Set<JWSAlgorithm> SUPPORTED_ALGORITHMS
          The supported JWS algorithms.
 
Constructor Summary
RSASSASigner(RSAPrivateKey privateKey)
          Creates a new RSA Signature-Scheme-with-Appendix (RSASSA) signer.
 
Method Summary
 RSAPrivateKey getPrivateKey()
          Gets the private RSA key.
protected static Signature getRSASignerAndVerifier(JWSAlgorithm alg)
          Gets an RSA signer and verifier for the specified RSASSA-based JSON Web Algorithm (JWA).
 Base64URL sign(ReadOnlyJWSHeader header, byte[] signingInput)
          Signs the specified input of a JWS object.
 Set<JWSAlgorithm> supportedAlgorithms()
          Returns the names of the supported JWS algorithms.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.nimbusds.jose.JWSAlgorithmProvider
supportedAlgorithms
 

Field Detail

SUPPORTED_ALGORITHMS

public static final Set<JWSAlgorithm> SUPPORTED_ALGORITHMS
The supported JWS algorithms.

Constructor Detail

RSASSASigner

public RSASSASigner(RSAPrivateKey privateKey)
Creates a new RSA Signature-Scheme-with-Appendix (RSASSA) signer.

Parameters:
privateKey - The private RSA key. Must not be null.
Method Detail

getPrivateKey

public RSAPrivateKey getPrivateKey()
Gets the private RSA key.

Returns:
The private RSA key.

sign

public Base64URL sign(ReadOnlyJWSHeader header,
                      byte[] signingInput)
               throws JOSEException
Description copied from interface: JWSSigner
Signs the specified input of a JWS object.

Specified by:
sign in interface JWSSigner
Parameters:
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.
Returns:
The resulting signature part (third part) of the JWS object.
Throws:
JOSEException - If the JWS algorithm is not supported or if signing failed for some other reason.

getRSASignerAndVerifier

protected static Signature getRSASignerAndVerifier(JWSAlgorithm alg)
                                            throws JOSEException
Gets an RSA signer and verifier for the specified RSASSA-based JSON Web Algorithm (JWA).

Parameters:
alg - The JSON Web Algorithm (JWA). Must be supported and not null.
Returns:
An RSA signer and verifier instance.
Throws:
JOSEException - If the algorithm is not supported.

supportedAlgorithms

public Set<JWSAlgorithm> supportedAlgorithms()
Description copied from interface: JWSAlgorithmProvider
Returns the names of the supported JWS algorithms. These correspond to the alg JWS header parameter.

Specified by:
supportedAlgorithms in interface JWSAlgorithmProvider
Returns:
The supported JWS algorithms, empty set if none.


Copyright © 2013 NimbusDS. All Rights Reserved.