com.nimbusds.jose.crypto
public class RSAEncrypter extends Object implements JWEEncrypter
JWE objects
. This class
is thread-safe.
Supports the following JWE algorithms:
Supports the following encryption methods:
Modifier and Type | Field and Description |
---|---|
static Set<JWEAlgorithm> |
SUPPORTED_ALGORITHMS
The supported JWE algorithms.
|
static Set<EncryptionMethod> |
SUPPORTED_ENCRYPTION_METHODS
The supported encryption methods.
|
Constructor and Description |
---|
RSAEncrypter(RSAPublicKey publicKey)
Creates a new RSA encrypter.
|
Modifier and Type | Method and Description |
---|---|
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
supportedAlgorithms, supportedEncryptionMethods
public static final Set<JWEAlgorithm> SUPPORTED_ALGORITHMS
public static final Set<EncryptionMethod> SUPPORTED_ENCRYPTION_METHODS
public RSAEncrypter(RSAPublicKey publicKey) throws JOSEException
publicKey
- The public RSA key. Must not be null
.JOSEException
- If the underlying secure random generator
couldn't be instantiated.public RSAPublicKey getPublicKey()
public JWECryptoParts encrypt(ReadOnlyJWEHeader readOnlyJWEHeader, byte[] bytes) throws JOSEException
JWEEncrypter
JWE object
.encrypt
in interface JWEEncrypter
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
.JOSEException
- If the JWE algorithm is not supported or if
encryption failed for some other reason.public Set<JWEAlgorithm> supportedAlgorithms()
JWEAlgorithmProvider
alg
JWE header parameter.supportedAlgorithms
in interface JWEAlgorithmProvider
public Set<EncryptionMethod> supportedEncryptionMethods()
JWEAlgorithmProvider
enc
JWE header parameter.supportedEncryptionMethods
in interface JWEAlgorithmProvider
Copyright © 2013 NimbusDS. All Rights Reserved.