Package com.nimbusds.jose.crypto.impl
Class AESCryptoProvider
java.lang.Object
com.nimbusds.jose.crypto.impl.BaseJWEProvider
com.nimbusds.jose.crypto.impl.AESCryptoProvider
- All Implemented Interfaces:
JCAAware<JWEJCAContext>
,JOSEProvider
,JWEProvider
- Direct Known Subclasses:
AESDecrypter
,AESEncrypter
The base abstract class for AES and AES GCM key wrap encrypters and
decrypters of
JWE objects
.
Supports the following key management algorithms:
JWEAlgorithm.A128KW
JWEAlgorithm.A192KW
JWEAlgorithm.A256KW
JWEAlgorithm.A128GCMKW
JWEAlgorithm.A192GCMKW
JWEAlgorithm.A256GCMKW
Supports the following content encryption algorithms:
- Version:
- 2015-06-29
- Author:
- Melisa Halsband, Vladimir Dzhuvinov
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Map<Integer,
Set<JWEAlgorithm>> The JWE algorithms compatible with each key size in bits.static final Set<JWEAlgorithm>
The supported JWE algorithms by the AES crypto provider class.static final Set<EncryptionMethod>
The supported encryption methods by the AES crypto provider class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AESCryptoProvider
(SecretKey kek, SecretKey cek) Creates a new AES encryption / decryption provider. -
Method Summary
Methods inherited from class com.nimbusds.jose.crypto.impl.BaseJWEProvider
getCEK, getJCAContext, isCEKProvided, supportedEncryptionMethods, supportedJWEAlgorithms
-
Field Details
-
SUPPORTED_ALGORITHMS
The supported JWE algorithms by the AES crypto provider class. -
SUPPORTED_ENCRYPTION_METHODS
The supported encryption methods by the AES crypto provider class. -
COMPATIBLE_ALGORITHMS
The JWE algorithms compatible with each key size in bits.
-
-
Constructor Details
-
AESCryptoProvider
Creates a new AES encryption / decryption provider.- Parameters:
kek
- The Key Encryption Key. Must be 128 bits (16 bytes), 192 bits (24 bytes) or 256 bits (32 bytes). Must not benull
.cek
- The content encryption key (CEK) to use. If specified its algorithm must be "AES" or "ChaCha20" and its length must match the expected for the JWE encryption method ("enc"). Ifnull
a CEK will be generated for each JWE.- Throws:
KeyLengthException
- If the KEK length is invalid.
-
-
Method Details
-
getKey
Gets the Key Encryption Key (KEK).- Returns:
- The Key Encryption Key.
-