Package com.nimbusds.jose.crypto.impl
Class DirectCryptoProvider
- java.lang.Object
-
- com.nimbusds.jose.crypto.impl.DirectCryptoProvider
-
- All Implemented Interfaces:
JCAAware<JWEJCAContext>,JOSEProvider,JWEProvider
- Direct Known Subclasses:
DirectDecrypter,DirectEncrypter
public abstract class DirectCryptoProvider extends java.lang.ObjectThe base abstract class for direct encrypters and decrypters ofJWE objectswith a shared symmetric key.Supports the following key management algorithms:
Supports the following content encryption algorithms:
- Version:
- 2022-09-20
- Author:
- Vladimir Dzhuvinov
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Set<JWEAlgorithm>SUPPORTED_ALGORITHMSThe supported JWE algorithms by the direct crypto provider class.static java.util.Set<EncryptionMethod>SUPPORTED_ENCRYPTION_METHODSThe supported encryption methods by the direct crypto provider class.
-
Constructor Summary
Constructors Modifier Constructor Description protectedDirectCryptoProvider(javax.crypto.SecretKey cek)Creates a new direct encryption / decryption provider.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JWEJCAContextgetJCAContext()Returns the Java Cryptography Architecture (JCA) context.javax.crypto.SecretKeygetKey()Gets the Content Encryption Key (CEK).java.util.Set<EncryptionMethod>supportedEncryptionMethods()Returns the names of the supported encryption methods by the JWE provier.java.util.Set<JWEAlgorithm>supportedJWEAlgorithms()Returns the names of the supported algorithms by the JWE provider instance.
-
-
-
Field Detail
-
SUPPORTED_ALGORITHMS
public static final java.util.Set<JWEAlgorithm> SUPPORTED_ALGORITHMS
The supported JWE algorithms by the direct crypto provider class.
-
SUPPORTED_ENCRYPTION_METHODS
public static final java.util.Set<EncryptionMethod> SUPPORTED_ENCRYPTION_METHODS
The supported encryption methods by the direct crypto provider class.
-
-
Constructor Detail
-
DirectCryptoProvider
protected DirectCryptoProvider(javax.crypto.SecretKey cek) throws KeyLengthExceptionCreates a new direct encryption / decryption provider.- Parameters:
cek- The Content Encryption Key (CEK). Must be 128 bits (16 bytes), 192 bits (24 bytes), 256 bits (32 bytes), 384 bits (48 bytes) or 512 bits (64 bytes) long. Must not benull.- Throws:
KeyLengthException- If the CEK length is not compatible.
-
-
Method Detail
-
getKey
public javax.crypto.SecretKey getKey()
Gets the Content Encryption Key (CEK).- Returns:
- The key.
-
supportedJWEAlgorithms
public java.util.Set<JWEAlgorithm> supportedJWEAlgorithms()
Description copied from interface:JWEProviderReturns the names of the supported algorithms by the JWE provider instance. These correspond to thealgJWE header parameter.- Specified by:
supportedJWEAlgorithmsin interfaceJWEProvider- Returns:
- The supported JWE algorithms, empty set if none.
-
supportedEncryptionMethods
public java.util.Set<EncryptionMethod> supportedEncryptionMethods()
Description copied from interface:JWEProviderReturns the names of the supported encryption methods by the JWE provier. These correspond to theencJWE header parameter.- Specified by:
supportedEncryptionMethodsin interfaceJWEProvider- Returns:
- The supported encryption methods, empty set if none.
-
getJCAContext
public JWEJCAContext getJCAContext()
Description copied from interface:JCAAwareReturns the Java Cryptography Architecture (JCA) context. May be used to set a specific JCA security provider or secure random generator.- Specified by:
getJCAContextin interfaceJCAAware<JWEJCAContext>- Returns:
- The JCA context. Not
null.
-
-