Class AlgorithmInfo

java.lang.Object
co.ankatech.ankasecure.sdk.model.AlgorithmInfo

public final class AlgorithmInfo extends Object
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"
 }
 
Since:
3.0.0
See Also:
  • Constructor Details

    • AlgorithmInfo

      public AlgorithmInfo()
      Zero-arg constructor for deserialization frameworks.
  • Method Details

    • getKty

      public String getKty()
    • setKty

      public void setKty(String kty)
    • getAlg

      public String getAlg()
    • setAlg

      public void setAlg(String alg)
    • getKeyOps

      public List<String> getKeyOps()
      Returns an unmodifiable copy to protect internal state.
    • setKeyOps

      public void setKeyOps(List<String> keyOps)
    • getStatus

      public AlgorithmInfo.Status getStatus()
    • setStatus

      public void setStatus(AlgorithmInfo.Status status)
    • getSunsetDate

      public LocalDate getSunsetDate()
    • setSunsetDate

      public void setSunsetDate(LocalDate sunsetDate)
    • getAdvisory

      public String getAdvisory()
    • setAdvisory

      public void setAdvisory(String advisory)
    • getSecurityLevel

      public Integer getSecurityLevel()
    • setSecurityLevel

      public void setSecurityLevel(Integer securityLevel)
    • getStandards

      public List<String> getStandards()
      Returns an unmodifiable copy to protect internal state.
    • setStandards

      public void setStandards(List<String> standards)
    • getCategory

      public AlgorithmInfo.Category getCategory()
      Returns the algorithm category.
    • setCategory

      public void setCategory(AlgorithmInfo.Category category)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object