Enum Class XECAlgorithm
- All Implemented Interfaces:
JWAAlgorithm<XECJWK>
,Serializable
,Comparable<XECAlgorithm>
,Constable
OKP Elliptic curve key management algorithms as defined by RFC8037 Section 3.1.
Key management algorithms:
- ECDH_ES-ES
- ECDH-ES+A128KW
- ECDH-ES+A192KW
- ECDH-ES+A256KW
These algorithms must be used with Octet Key Pair curves OKPCurve.X25519
and OKPCurve.X448
, they extends ECDH-ES algorithms with NIST Elliptic curves defined by ECAlgorithm
and ECCurve
.
- 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 ConstantDescriptionECDH-ES with X25519 or X448 curve as defined by RFC8037 Section 3.2ECDH-ES+A128KW with X25519 or X448 curve as defined by RFC8037 Section 3.2ECDH-ES+A192KW with X25519 or X448 curve as defined by RFC8037 Section 3.2ECDH-ES+A256KW with X25519 or X448 curve as defined by RFC8037 Section 3.2 -
Method Summary
Modifier and TypeMethodDescriptioncreateCipher
(XECJWK jwk) Creates a cipher from the algorithm.createKeyManager
(XECJWK jwk) Creates a key manager from the algorithm.createSigner
(XECJWK jwk) Creates a signer from the algorithm.static XECAlgorithm
fromAlgorithm
(String alg) Returns the OKP Elliptic curve key management algorithm corresponding to the specified JWA registered algorithm name.Returns the JWA registered name of the algorithm.Returns a JCA key wrapping algorithm to be used to wrap a derived key.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 XECAlgorithm
Returns the enum constant of this class with the specified name.static XECAlgorithm[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ECDH_ES
ECDH-ES with X25519 or X448 curve as defined by RFC8037 Section 3.2 -
ECDH_ES_A128KW
ECDH-ES+A128KW with X25519 or X448 curve as defined by RFC8037 Section 3.2 -
ECDH_ES_A192KW
ECDH-ES+A192KW with X25519 or X448 curve as defined by RFC8037 Section 3.2 -
ECDH_ES_A256KW
ECDH-ES+A256KW with X25519 or X448 curve as defined by RFC8037 Section 3.2
-
-
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<XECJWK>
- 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<XECJWK>
- 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<XECJWK>
- 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<XECJWK>
- 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<XECJWK>
- 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<XECJWK>
- 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<XECJWK>
- 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
-
getKeyWrappingAlgorithm
Returns a JCA key wrapping algorithm to be used to wrap a derived key.
- Returns:
- a JCA key wrapping algorithm or null
-
fromAlgorithm
Returns the OKP Elliptic curve key management algorithm corresponding to the specified JWA registered algorithm name.
- Parameters:
alg
- a JWA registered algorithm name- Returns:
- an OKP Elliptic curve key management algorithm
- Throws:
IllegalArgumentException
- if the specified algorithm is not an OKP Elliptic curve key management algorithm
-