Enum Class OCTAlgorithm
- All Implemented Interfaces:
JWAAlgorithm<OCTJWK>
,Serializable
,Comparable<OCTAlgorithm>
,Constable
Octect symmetric algorithms as defined by RFC7518.
Signature algorithms:
- HS256
- HS384
- HS512
Key Management algorithms:
- A128KW
- A256KW
- A512KW
- A128GCMKW
- A192GCMKW
- A256GCMKW
Encryption algorithms:
- A128GCM
- A192GCM
- A256GCM
- A128CBC-HS256
- A192CBC-HS384
- A256CBC-HS512
- 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 ConstantDescriptionA128CBC-HS256 encryption algorithm as defined by RFC7518 Section 5.2.6A128GCM encryption algorithm as defined by RFC7518 Section 5.3A128GCMKW key management algorithm as defined by RFC7518 Section 4.7A128KW key management algorithm as defined by RFC7518 Section 4.4A192CBC-HS384 encryption algorithm as defined by RFC7518 Section 5.2.6A192GCM encryption algorithm as defined by RFC7518 Section 5.3A192GCMKW key management algorithm as defined by RFC7518 Section 4.7A192KW key management algorithm as defined by RFC7518 Section 4.4A256CBC-HS512 encryption algorithm as defined by RFC7518 Section 5.2.6A256GCM encryption algorithm as defined by RFC7518 Section 5.3A256GCMKW key management algorithm as defined by RFC7518 Section 4.7A256KW key management algorithm as defined by RFC7518 Section 4.4HS256 signature algorithm as defined by RFC7518 Section 3.2HS384 signature algorithm as defined by RFC7518 Section 3.2HS512 signature algorithm as defined by RFC7518 Section 3.2 -
Method Summary
Modifier and TypeMethodDescriptioncreateCipher
(OCTJWK jwk) Creates a cipher from the algorithm.createKeyManager
(OCTJWK jwk) Creates a key manager from the algorithm.createSigner
(OCTJWK jwk) Creates a signer from the algorithm.static OCTAlgorithm
fromAlgorithm
(String alg) Returns the Octet symmetric algorithm corresponding to the specified JWA registered algorithm name.Returns the JWA registered name of the algorithm.Returns the authentication tag length in bytes.int
Returns the encryption key length in bytes.Returns the initialization vector length in bytes.Return the JCA algorithm corresponding to the JWA algorithm.Return the JCA Mac algorithm.Return the Mac key length in bytes.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 OCTAlgorithm
Returns the enum constant of this class with the specified name.static OCTAlgorithm[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
HS256
HS256 signature algorithm as defined by RFC7518 Section 3.2 -
HS384
HS384 signature algorithm as defined by RFC7518 Section 3.2 -
HS512
HS512 signature algorithm as defined by RFC7518 Section 3.2 -
A128KW
A128KW key management algorithm as defined by RFC7518 Section 4.4 -
A192KW
A192KW key management algorithm as defined by RFC7518 Section 4.4 -
A256KW
A256KW key management algorithm as defined by RFC7518 Section 4.4 -
A128GCMKW
A128GCMKW key management algorithm as defined by RFC7518 Section 4.7 -
A192GCMKW
A192GCMKW key management algorithm as defined by RFC7518 Section 4.7 -
A256GCMKW
A256GCMKW key management algorithm as defined by RFC7518 Section 4.7 -
A128CBC_HS256
A128CBC-HS256 encryption algorithm as defined by RFC7518 Section 5.2.6 -
A192CBC_HS384
A192CBC-HS384 encryption algorithm as defined by RFC7518 Section 5.2.6 -
A256CBC_HS512
A256CBC-HS512 encryption algorithm as defined by RFC7518 Section 5.2.6 -
A128GCM
A128GCM encryption algorithm as defined by RFC7518 Section 5.3 -
A192GCM
A192GCM encryption algorithm as defined by RFC7518 Section 5.3 -
A256GCM
A256GCM encryption algorithm as defined by RFC7518 Section 5.3
-
-
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<OCTJWK>
- 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<OCTJWK>
- 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<OCTJWK>
- 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<OCTJWK>
- 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<OCTJWK>
- 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<OCTJWK>
- 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<OCTJWK>
- 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
-
getEncryptionKeyLength
public int getEncryptionKeyLength()Returns the encryption key length in bytes.
- Returns:
- the encryption key length in bytes
-
getInitializationVectorLength
Returns the initialization vector length in bytes.
Note that this only applies to encryption algorithms.
- Returns:
- the initialization vector key length in bytes or null
-
getAuthenticationTagLength
Returns the authentication tag length in bytes.
Note that this only applies to encryption algorithms.
- Returns:
- the authentication tag key length in bytes or null
-
getMacAlgorithm
Return the JCA Mac algorithm.
Note that this only applies to algorithms where a MAC is computed.
- Returns:
- a JCA Mac algorithm or null
-
getMacKeyLength
Return the Mac key length in bytes.
Note that this only applies to algorithms where a MAC is computed.
- Returns:
- a Mac key length in bytes
-
fromAlgorithm
Returns the Octet symmetric algorithm corresponding to the specified JWA registered algorithm name.
- Parameters:
alg
- a JWA registered algorithm name- Returns:
- an octet symmetric algorithm
- Throws:
IllegalArgumentException
- if the specified algorithm is not an OCT algorithm.
-