Package zeroecho.core.alg.frodo


package zeroecho.core.alg.frodo
FrodoKEM post-quantum key encapsulation integration.

This package integrates the Frodo lattice-based key encapsulation mechanism (KEM) into the core layer. It provides the algorithm descriptor, runtime KEM context, key generation specifications, and encoded key specs for import and export. Frodo is based on the hardness of the Learning With Errors (LWE) problem, avoiding structured lattices and offering conservative security margins.

Scope and responsibilities

  • Register Frodo under a canonical identifier and declare KeyUsage.ENCAPSULATE and KeyUsage.DECAPSULATE roles, plus an agreement adapter role for initiator/responder workflows.
  • Provide a KemContext implementation bound to either a public or private key for encapsulation or decapsulation.
  • Expose immutable key-generation specifications and defensively copying encoded-key carriers with marshalling helpers; private-key carriers are destroyable.
  • Ensure operations are delegated to a supported PQC provider (BouncyCastle PQC) and fail fast if absent.

Components

  • FrodoAlgorithm: algorithm descriptor that wires KEM and agreement roles and registers key builders.
  • FrodoKemContext: runtime context implementing encapsulate and decapsulate operations using BouncyCastle’s Frodo engine.
  • FrodoKeyGenSpec: immutable specification of the Frodo variant (976, 1344; AES or SHAKE-based), with convenience factories.
  • FrodoPublicKeySpec / FrodoPrivateKeySpec: wrappers over X.509 and PKCS#8 encodings with defensive copying and PairSeq marshalling utilities.

Design notes

  • Algorithm descriptors are immutable and safe to share across threads.
  • KEM contexts are stateful and not thread-safe; they are intended for single encapsulation or decapsulation operations.
  • Key specifications preserve encoded form without internal parsing and rely on defensive cloning for safety.
  • Agreement adapters allow FrodoKEM to be composed into higher-level initiator/responder protocols transparently.
Since:
1.0