Package co.ankatech.ankasecure.sdk.model
Enum Class KeyOrigin
- All Implemented Interfaces:
Serializable,Comparable<KeyOrigin>,Constable
Indicates how a cryptographic key was created or acquired.
This enumeration tracks the provenance of cryptographic keys stored in the AnkaSecure platform, enabling different validation rules, operational restrictions, and lifecycle management based on key origin.
Origin Types:
- GENERATED: Key natively created by AnkaSecure platform. Full operational capabilities, no restrictions.
- IMPORTED: Key imported from external source (PKCS#12 keystore, JWK, etc.). May have operational restrictions if imported with expired certificate.
- DERIVED: Key derived from another key (e.g., via key derivation function). Reserved for future use.
Relationship with Restricted Field:
The origin field works together with the restricted boolean to determine
key operational capabilities:
| Origin | Restricted | Capabilities | Use Case |
|---|---|---|---|
| GENERATED | false/null | Full (encrypt, decrypt, sign, verify) | Standard platform-generated key |
| IMPORTED | false/null | Full (all operations) | Valid certificate import |
| IMPORTED | true | Read-only (decrypt, verify only) | Expired certificate import (legacy data access) |
Usage Example:
KeyMetadata metadata = sdk.getKeyMetadata("my-key");
// Check if key was imported
if (metadata.getOrigin() == KeyOrigin.IMPORTED) {
System.out.println("This key was imported from external source");
// Check for restrictions
if (Boolean.TRUE.equals(metadata.getRestricted())) {
System.out.println("WARNING: Key restricted to decrypt/verify only");
}
} else if (metadata.getOrigin() == KeyOrigin.GENERATED) {
System.out.println("This key was natively generated by AnkaSecure");
}
- Since:
- 3.0.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Methods inherited from class java.lang.Enum
compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Enum Constant Details
-
GENERATED
Key natively created by AnkaSecure platform using generate-key endpoint. Full operational capabilities with no restrictions. -
IMPORTED
Key imported from external source (PKCS#12, JWK, PEM, etc.). May have operational restrictions depending on certificate validity. -
DERIVED
Key derived from another key using key derivation functions. Reserved for future use in key hierarchy scenarios.
-
-
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
-