com.nimbusds.jose.crypto
Class RSAEncrypter

java.lang.Object
  extended by com.nimbusds.jose.crypto.RSAEncrypter
All Implemented Interfaces:
JWEAlgorithmProvider, JWEEncrypter

public class RSAEncrypter
extends Object
implements JWEEncrypter

RSA encrypter of JWE objects. This class is thread-safe.

Supports the following JWE algorithms:

Supports the following encryption methods:

Version:
$version$ (2013-05-16)
Author:
David Ortiz, Vladimir Dzhuvinov

Field Summary
static Set<JWEAlgorithm> SUPPORTED_ALGORITHMS
          The supported JWE algorithms.
static Set<EncryptionMethod> SUPPORTED_ENCRYPTION_METHODS
          The supported encryption methods.
 
Constructor Summary
RSAEncrypter(RSAPublicKey publicKey)
          Creates a new RSA encrypter.
 
Method Summary
 JWECryptoParts encrypt(ReadOnlyJWEHeader readOnlyJWEHeader, byte[] bytes)
          Encrypts the specified clear text of a JWE object.
 RSAPublicKey getPublicKey()
          Gets the public RSA key.
 Set<JWEAlgorithm> supportedAlgorithms()
          Returns the names of the supported JWE algorithms.
 Set<EncryptionMethod> supportedEncryptionMethods()
          Returns the names of the supported encryption methods.
 
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.JWEAlgorithmProvider
supportedAlgorithms, supportedEncryptionMethods
 

Field Detail

SUPPORTED_ALGORITHMS

public static final Set<JWEAlgorithm> SUPPORTED_ALGORITHMS
The supported JWE algorithms.


SUPPORTED_ENCRYPTION_METHODS

public static final Set<EncryptionMethod> SUPPORTED_ENCRYPTION_METHODS
The supported encryption methods.

Constructor Detail

RSAEncrypter

public RSAEncrypter(RSAPublicKey publicKey)
             throws JOSEException
Creates a new RSA encrypter.

Parameters:
publicKey - The public RSA key. Must not be null.
Throws:
JOSEException - If the underlying secure random generator couldn't be instantiated.
Method Detail

getPublicKey

public RSAPublicKey getPublicKey()
Gets the public RSA key.

Returns:
The public RSA key.

encrypt

public JWECryptoParts encrypt(ReadOnlyJWEHeader readOnlyJWEHeader,
                              byte[] bytes)
                       throws JOSEException
Description copied from interface: JWEEncrypter
Encrypts the specified clear text of a JWE object.

Specified by:
encrypt in interface JWEEncrypter
Parameters:
readOnlyJWEHeader - The JSON Web Encryption (JWE) header. Must specify a supported JWE algorithm and must not be null.
bytes - The clear text to encrypt. Must not be null.
Returns:
The resulting JWE crypto parts.
Throws:
JOSEException - If the JWE algorithm is not supported or if encryption failed for some other reason.

supportedAlgorithms

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

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

supportedEncryptionMethods

public Set<EncryptionMethod> supportedEncryptionMethods()
Description copied from interface: JWEAlgorithmProvider
Returns the names of the supported encryption methods. These correspond to the enc JWE header parameter.

Specified by:
supportedEncryptionMethods in interface JWEAlgorithmProvider
Returns:
The supported encryption methods, empty set if none.


Copyright © 2013 NimbusDS. All Rights Reserved.