Package co.ankatech.ankasecure.sdk.model
Class AlgorithmInfo
java.lang.Object
co.ankatech.ankasecure.sdk.model.AlgorithmInfo
Immutable value object representing a supported algorithm profile.
Provides complete metadata about an algorithm including lifecycle status,
security level, compliance standards, and composite key compatibility.
Use AuthenticatedSdk.getSupportedAlgorithms() to discover all available
algorithms, then filter by criteria using AlgorithmFilter.
Understanding Algorithm Properties
Status Values
- RECOMMENDED: Production-ready, actively maintained, NIST-approved. Use for new keys.
- LEGACY: Deprecated but still supported for backward compatibility. Plan migration to RECOMMENDED algorithms.
- EXPERIMENTAL: Preview/beta, not for production. May change in future versions.
Category Values
- CLASSICAL: Traditional algorithms (RSA, ECDSA, AES). Vulnerable to quantum computers.
- POST_QUANTUM: Quantum-resistant algorithms (ML-KEM, ML-DSA, SLH-DSA). Standardized by NIST.
Security Levels (NIST)
- Level 1: Equivalent to AES-128 (~2^128 operations to break)
- Level 2: Equivalent to SHA-256 collision resistance
- Level 3: Equivalent to AES-192 (~2^192 operations)
- Level 4: Equivalent to SHA-384 collision resistance
- Level 5: Equivalent to AES-256 (~2^256 operations)
Usage Examples
Example 1: Find PQC Encryption Algorithms
List<AlgorithmInfo> algorithms = sdk.getSupportedAlgorithms();
List<AlgorithmInfo> pqcEncryption = algorithms.stream()
.filter(a -> a.getCategory() == AlgorithmInfo.Category.POST_QUANTUM)
.filter(a -> a.getKeyOps().contains("encrypt"))
.filter(a -> a.getStatus() == AlgorithmInfo.Status.RECOMMENDED)
.collect(Collectors.toList());
pqcEncryption.forEach(alg -> {
System.out.println("Algorithm: " + alg.getAlg());
System.out.println("Security level: " + alg.getSecurityLevel());
System.out.println("Standards: " + alg.getStandards());
});
// Output: ML-KEM-512 (Level 1), ML-KEM-768 (Level 3), ML-KEM-1024 (Level 5)
Example 2: Find Hybrid Algorithms
List<AlgorithmInfo> hybrids = algorithms.stream()
.filter(a -> a.getCategory() == AlgorithmInfo.Category.HYBRID)
.filter(a -> a.getStatus() == AlgorithmInfo.Status.RECOMMENDED)
.collect(Collectors.toList());
hybrids.forEach(alg -> {
System.out.println("Hybrid: " + alg.getAlg());
System.out.println("Key type: " + alg.getKty());
System.out.println("Security level: " + alg.getSecurityLevel());
});
// Output:
// Hybrid: X25519+ML-KEM-768 (kty: COMPOSITE_KEM_COMBINE, Level 3)
// Hybrid: Ed25519+ML-DSA-44 (kty: COMPOSITE_SIGNATURE, Level 2)
Example 3: Filter by Compliance Standards
// Find FIPS-approved algorithms
List<AlgorithmInfo> fipsAlgorithms = algorithms.stream()
.filter(a -> a.getStandards().contains("FIPS"))
.filter(a -> a.getStatus() == AlgorithmInfo.Status.RECOMMENDED)
.collect(Collectors.toList());
// Find EU-compliant algorithms
List<AlgorithmInfo> euCompliant = algorithms.stream()
.filter(a -> a.getStandards().contains("ETSI") ||
a.getStandards().contains("BSI"))
.collect(Collectors.toList());
Example 4: Check Sunset Dates
algorithms.stream()
.filter(a -> a.getSunsetDate() != null)
.filter(a -> a.getSunsetDate().isBefore(LocalDate.now().plusMonths(6)))
.forEach(alg -> {
System.out.println("URGENT: " + alg.getAlg() + " sunsets on " + alg.getSunsetDate());
System.out.println("Advisory: " + alg.getAdvisory());
});
JSON Example:
{
"kty" : "ML-KEM",
"alg" : "ML-KEM-768",
"keyOps" : ["encrypt", "decrypt"],
"status" : "RECOMMENDED",
"sunsetDate" : "2025-12-31",
"advisory" : "Use only for transitional re-encryption.",
"securityLevel" : 3,
"standards" : ["NIST", "ISO"],
"category" : "POST_QUANTUM"
}
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumCategory of the algorithm: classical vs. post-quantum vs. hybrid.static enumLifecycle status as defined by the platform. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleangetAlg()Returns the algorithm category.Returns an unmodifiable copy to protect internal state.getKty()Returns an unmodifiable copy to protect internal state.inthashCode()voidsetAdvisory(String advisory) voidvoidsetCategory(AlgorithmInfo.Category category) voidvoidvoidsetSecurityLevel(Integer securityLevel) voidsetStandards(List<String> standards) voidsetStatus(AlgorithmInfo.Status status) voidsetSunsetDate(LocalDate sunsetDate) toString()
-
Constructor Details
-
AlgorithmInfo
public AlgorithmInfo()Zero-arg constructor for deserialization frameworks.
-
-
Method Details
-
getKty
-
setKty
-
getAlg
-
setAlg
-
getKeyOps
Returns an unmodifiable copy to protect internal state. -
setKeyOps
-
getStatus
-
setStatus
-
getSunsetDate
-
setSunsetDate
-
getAdvisory
-
setAdvisory
-
getSecurityLevel
-
setSecurityLevel
-
getStandards
Returns an unmodifiable copy to protect internal state. -
setStandards
-
getCategory
Returns the algorithm category. -
setCategory
-
toString
-
equals
-
hashCode
public int hashCode()
-