com.nimbusds.jose.crypto
Class RSASSAVerifier

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

@ThreadSafe
public class RSASSAVerifier
extends java.lang.Object
implements JWSVerifier

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

Supports the following JSON Web Algorithms (JWAs):

Accepts the following JWS header parameters:

Version:
$version$ (2012-10-23)
Author:
Vladimir Dzhuvinov

Field Summary
static java.util.Set<JWSAlgorithm> SUPPORTED_ALGORITHMS
          The supported JWS algorithms.
 
Constructor Summary
RSASSAVerifier(java.security.interfaces.RSAPublicKey publicKey)
          Creates a new RSA Signature-Scheme-with-Appendix (RSASSA) verifier.
 
Method Summary
 JWSHeaderFilter getJWSHeaderFilter()
          Gets the JWS header filter associated with the verifier.
 java.security.interfaces.RSAPublicKey getPublicKey()
          Gets the public RSA key.
protected static java.security.Signature getRSASignerAndVerifier(JWSAlgorithm alg)
          Gets an RSA signer and verifier for the specified RSASSA-based JSON Web Algorithm (JWA).
 java.util.Set<JWSAlgorithm> supportedAlgorithms()
          Returns the names of the supported JWS algorithms.
 boolean verify(ReadOnlyJWSHeader header, byte[] signedContent, Base64URL signature)
          Verifies the specified signature of a JWS object.
 
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 java.util.Set<JWSAlgorithm> SUPPORTED_ALGORITHMS
The supported JWS algorithms.

Constructor Detail

RSASSAVerifier

public RSASSAVerifier(java.security.interfaces.RSAPublicKey publicKey)
Creates a new RSA Signature-Scheme-with-Appendix (RSASSA) verifier.

Parameters:
publicKey - The public RSA key. Must not be null.
Method Detail

getPublicKey

public java.security.interfaces.RSAPublicKey getPublicKey()
Gets the public RSA key.

Returns:
The public RSA key.

getJWSHeaderFilter

public JWSHeaderFilter getJWSHeaderFilter()
Description copied from interface: JWSVerifier
Gets the JWS header filter associated with the verifier. Specifies the names of those supported JWS algorithms and header parameters that the verifier is configured to accept.

Attempting to verify a JWS object signature with an algorithm or header parameter that is not accepted must result in a JOSEException.

Specified by:
getJWSHeaderFilter in interface JWSVerifier
Returns:
The JWS header filter.

verify

public boolean verify(ReadOnlyJWSHeader header,
                      byte[] signedContent,
                      Base64URL signature)
               throws JOSEException
Description copied from interface: JWSVerifier
Verifies the specified signature of a JWS object.

Specified by:
verify in interface JWSVerifier
Parameters:
header - The JSON Web Signature (JWS) header. Must specify an accepted JWS algorithm, must contain only accepted header parameters, and must not be null.
signedContent - The signed content. Must not be null.
signature - The signature part of the JWS object. Must not be null.
Returns:
true if the signature was successfully verified, else false.
Throws:
JOSEException - If the JWS algorithm is not accepted, if a header parameter is not accepted, or if signature verification failed for some other reason.

getRSASignerAndVerifier

protected static java.security.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 java.util.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.