Enum Class PBES2Algorithm
- All Implemented Interfaces:
JWAAlgorithm<PBES2JWK>
,Serializable
,Comparable<PBES2Algorithm>
,Constable
Password-based encryption key management algorithms as defined by RFC7518.
Key Management algorithms:
- PBES2-HS256+A128KW
- PBES2-HS384+A192KW
- PBES2-HS512+A256KW
- Since:
- 1.5
- Author:
- Jeremy Kuhn
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionPBES2-HS256+A128KW key management algorithm as defined by RFC7518 Section 4.8PBES2-HS384+A192KW key management algorithm as defined by RFC7518 Section 4.8PBES2-HS512+A256KW key management algorithm as defined by RFC7518 Section 4.8 -
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The default iteration count.static final int
The default salt length.static final int
The minimum iteration count.static final int
The minimum salt length. -
Method Summary
Modifier and TypeMethodDescriptioncreateCipher
(PBES2JWK jwk) Creates a cipher from the algorithm.createKeyManager
(PBES2JWK jwk) Creates a key manager from the algorithm.createSigner
(PBES2JWK jwk) Creates a signer from the algorithm.static PBES2Algorithm
fromAlgorithm
(String alg) Returns the password-based encryption key management algorithm corresponding to the specified JWA registered algorithm name.Returns the JWA registered name of the algorithm.int
Returns the encryption key length in bytes.Return the JCA algorithm corresponding to the JWA algorithm.Return the JCA encryption algorithm.boolean
Determines whether the algorithm is an encryption algorithm.boolean
Determines whether the algorithm is a key management algorithm.boolean
Determines whether the algorithm is a signature algorithm.static PBES2Algorithm
Returns the enum constant of this class with the specified name.static PBES2Algorithm[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
PBES2_HS256_A128KW
PBES2-HS256+A128KW key management algorithm as defined by RFC7518 Section 4.8 -
PBES2_HS384_A192KW
PBES2-HS384+A192KW key management algorithm as defined by RFC7518 Section 4.8 -
PBES2_HS512_A256KW
PBES2-HS512+A256KW key management algorithm as defined by RFC7518 Section 4.8
-
-
Field Details
-
MINIMUM_SALT_LENGTH
public static final int MINIMUM_SALT_LENGTHThe minimum salt length.- See Also:
-
DEFAULT_SALT_LENGTH
public static final int DEFAULT_SALT_LENGTHThe default salt length.- See Also:
-
MINIMUM_ITERATION_COUNT
public static final int MINIMUM_ITERATION_COUNTThe minimum iteration count.- See Also:
-
DEFAULT_ITERATION_COUNT
public static final int DEFAULT_ITERATION_COUNTThe default iteration count.- See Also:
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
getAlgorithm
Description copied from interface:JWAAlgorithm
Returns the JWA registered name of the algorithm.
- Specified by:
getAlgorithm
in interfaceJWAAlgorithm<PBES2JWK>
- Returns:
- a JWA registered name
-
isSignature
public boolean isSignature()Description copied from interface:JWAAlgorithm
Determines whether the algorithm is a signature algorithm.
- Specified by:
isSignature
in interfaceJWAAlgorithm<PBES2JWK>
- Returns:
- true if the algorithm is a signature algorithm, false otherwise
-
isKeyManagement
public boolean isKeyManagement()Description copied from interface:JWAAlgorithm
Determines whether the algorithm is a key management algorithm.
- Specified by:
isKeyManagement
in interfaceJWAAlgorithm<PBES2JWK>
- Returns:
- true if the algorithm is a key management algorithm, false otherwise
-
isEncryption
public boolean isEncryption()Description copied from interface:JWAAlgorithm
Determines whether the algorithm is an encryption algorithm.
- Specified by:
isEncryption
in interfaceJWAAlgorithm<PBES2JWK>
- Returns:
- true if the algorithm is an encryption algorithm, false otherwise
-
createSigner
Description copied from interface:JWAAlgorithm
Creates a signer from the algorithm.
- Specified by:
createSigner
in interfaceJWAAlgorithm<PBES2JWK>
- Parameters:
jwk
- the key to use for signing- Returns:
- a JWA signer
- Throws:
JWAProcessingException
- if the algorithm is not a signature algorithm or if there was an error creating the signer
-
createKeyManager
Description copied from interface:JWAAlgorithm
Creates a key manager from the algorithm.
- Specified by:
createKeyManager
in interfaceJWAAlgorithm<PBES2JWK>
- Parameters:
jwk
- the key to use for signing- Returns:
- a JWA key manager
- Throws:
JWAProcessingException
- if the algorithm is not a key management algorithm or if there was an error creating the key manager
-
createCipher
Description copied from interface:JWAAlgorithm
Creates a cipher from the algorithm.
- Specified by:
createCipher
in interfaceJWAAlgorithm<PBES2JWK>
- Parameters:
jwk
- the key to use for signing- Returns:
- a JWA cipher
- Throws:
JWAProcessingException
- if the algorithm is not an encryption algorithm or if there was an error creating the cipher
-
getJcaAlgorithm
Return the JCA algorithm corresponding to the JWA algorithm.
- Returns:
- a JCA algorithm name
-
getJcaEncryptionAlgorithm
Return the JCA encryption algorithm.
- Returns:
- a JCA algorithm name
-
getEncryptionKeyLength
public int getEncryptionKeyLength()Returns the encryption key length in bytes.
- Returns:
- the encryption key length in bytes
-
fromAlgorithm
Returns the password-based encryption key management algorithm corresponding to the specified JWA registered algorithm name.
- Parameters:
alg
- a JWA registered algorithm name- Returns:
- a password-based encryption key management algorithm
- Throws:
IllegalArgumentException
- if the specified algorithm is not a PBES2 algorithm.
-