Package zeroecho.core
Enum Class KeyUsage
- All Implemented Interfaces:
Serializable,Comparable<KeyUsage>,Constable
Declares the intended purpose(s) of a cryptographic key.
Keys should be bound to a specific KeyUsage at generation or import
time. Enforcing usage prevents accidental cross-purposes — e.g., reusing a
signing key for encryption, or using a MAC key for key agreement — which can
lead to serious vulnerabilities.
Typical usages
SIGN/VERIFY: digital signature schemes (Ed25519, ECDSA, RSA-PSS).ENCRYPT/DECRYPT: confidentiality with symmetric or asymmetric encryption.ENCAPSULATE/DECAPSULATE: key encapsulation mechanisms (KEM).MAC: keyed message authentication (e.g., HMAC, KMAC).DIGEST: unkeyed hashing (e.g., SHA-256, SHA3-512).AGREEMENT: key agreement (e.g., X25519, ECDH) to derive shared secrets.
Security note: Many real-world breaches trace back to cryptographic
keys being used outside their intended purpose. Libraries should validate
KeyUsage before performing operations.
- Since:
- 1.0
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionPerform key agreement (e.g., X25519, ECDH).Decapsulate a shared secret in a KEM flow.Decrypt data that was encrypted under the matching key/parameters.Compute an unkeyed hash (e.g., SHA-256), pipeline-friendly.Encapsulate a shared secret in a KEM flow.Encrypt data for confidentiality.Compute a keyed message authentication code (e.g., HMAC, KMAC).Create digital signatures.Verify digital signatures. -
Method Summary
-
Enum Constant Details
-
SIGN
Create digital signatures. -
VERIFY
Verify digital signatures. -
ENCRYPT
Encrypt data for confidentiality. -
DECRYPT
Decrypt data that was encrypted under the matching key/parameters. -
ENCAPSULATE
Encapsulate a shared secret in a KEM flow. -
DECAPSULATE
Decapsulate a shared secret in a KEM flow. -
MAC
Compute a keyed message authentication code (e.g., HMAC, KMAC). -
DIGEST
Compute an unkeyed hash (e.g., SHA-256), pipeline-friendly. -
AGREEMENT
Perform key agreement (e.g., X25519, ECDH).
-
-
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
-