public class RSADecrypter extends java.lang.Object implements JWEDecrypter
JWE objects. This class
is thread-safe.
Supports the following JWE algorithms:
Supports the following encryption methods:
EncryptionMethod.A128CBC_HS256
EncryptionMethod.A256CBC_HS512
EncryptionMethod.A128GCM
EncryptionMethod.A256GCM
Accepts all reserved JWE header parameters. Modify the header filter properties to restrict the acceptable JWE algorithms,
encryption methods and header parameters, or to allow custom JWE header
parameters.
| Modifier and Type | Field and Description |
|---|---|
static java.util.Set<JWEAlgorithm> |
SUPPORTED_ALGORITHMS
The supported JWE algorithms.
|
static java.util.Set<EncryptionMethod> |
SUPPORTED_ENCRYPTION_METHODS
The supported encryption methods.
|
| Constructor and Description |
|---|
RSADecrypter(java.security.interfaces.RSAPrivateKey privateKey)
Creates a new RSA decrypter.
|
| Modifier and Type | Method and Description |
|---|---|
protected static int |
cekBitLength(EncryptionMethod method)
Gets the Content Encryption Key (CEK) length for the specified
encryption method.
|
protected static int |
cikBitLength(EncryptionMethod method)
Gets the Content Integrity Key (CIK) length for the specified
encryption method.
|
protected static int |
cmkBitLength(EncryptionMethod method)
Gets the Content Master Key (CMK) length for the specified
encryption method.
|
byte[] |
decrypt(ReadOnlyJWEHeader readOnlyJWEHeader,
Base64URL encryptedKey,
Base64URL iv,
Base64URL cipherText,
Base64URL integrityValue)
Decrypts the specified cipher text of a
JWE Object. |
JWEHeaderFilter |
getJWEHeaderFilter()
Gets the JWE header filter associated with the decrypter.
|
java.security.interfaces.RSAPrivateKey |
getPrivateKey()
Gets the private RSA key.
|
java.util.Set<JWEAlgorithm> |
supportedAlgorithms()
Returns the names of the supported JWE algorithms.
|
java.util.Set<EncryptionMethod> |
supportedEncryptionMethods()
Returns the names of the supported encryption methods.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsupportedAlgorithms, supportedEncryptionMethodspublic static final java.util.Set<JWEAlgorithm> SUPPORTED_ALGORITHMS
public static final java.util.Set<EncryptionMethod> SUPPORTED_ENCRYPTION_METHODS
public RSADecrypter(java.security.interfaces.RSAPrivateKey privateKey)
privateKey - The private RSA key. Must not be null.public java.security.interfaces.RSAPrivateKey getPrivateKey()
public JWEHeaderFilter getJWEHeaderFilter()
JWEDecryptersupported JWE
algorithms and header parameters that the decrypter is configured to
accept.
Attempting to decrypt a JWE object with an
algorithm or header parameter that is not accepted must result in a
JOSEException.
getJWEHeaderFilter in interface JWEDecrypterpublic byte[] decrypt(ReadOnlyJWEHeader readOnlyJWEHeader, Base64URL encryptedKey, Base64URL iv, Base64URL cipherText, Base64URL integrityValue) throws JOSEException
JWEDecrypterJWE Object.decrypt in interface JWEDecrypterreadOnlyJWEHeader - The JSON Web Encryption (JWE) header. Must
specify an accepted JWE algorithm, must contain
only accepted header parameters, and must not
be null.encryptedKey - The encrypted key, null if not required
by the JWE algorithm.iv - The initialisation vector, null if not
required by the JWE algorithm.cipherText - The cipher text to decrypt. Must not be
null.integrityValue - The integrity value, null if not
required by the JWE algorithm.JOSEException - If the JWE algorithm is not accepted, if a
header parameter is not accepted, or if
decryption failed for some other reason.protected static int cmkBitLength(EncryptionMethod method) throws JOSEException
method - The encryption method. Must be supported by this RSA
provider. Must not be null.JOSEException - If the encryption method is not supported.protected static int cekBitLength(EncryptionMethod method) throws JOSEException
method - The encryption method. Must be supported by this RSA
provider and must employ CEKs. Must not be
null.JOSEException - If the encryption method is not supported or
doesn't employ CEKs.protected static int cikBitLength(EncryptionMethod method) throws JOSEException
method - The encryption method. Must be supported by this RSA
provider and must employ CIKs. Must not be
null.JOSEException - If the encryption method is not supported or
doesn't employ CIKs.public java.util.Set<JWEAlgorithm> supportedAlgorithms()
JWEAlgorithmProvideralg JWE header parameter.supportedAlgorithms in interface JWEAlgorithmProviderpublic java.util.Set<EncryptionMethod> supportedEncryptionMethods()
JWEAlgorithmProviderenc JWE header parameter.supportedEncryptionMethods in interface JWEAlgorithmProviderCopyright © 2013 NimbusDS. All Rights Reserved.