Package zeroecho.core.alg.hqc


package zeroecho.core.alg.hqc
HQC post-quantum key encapsulation integration.

This package integrates the HQC (Hamming Quasi-Cyclic) KEM into the core layer. It provides the algorithm descriptor, a runtime KEM context, and key specifications for generation and import. Provider-specific details are encapsulated behind small factories, while roles and metadata remain explicit to higher layers.

Scope and responsibilities

  • Register HQC under a canonical identifier and declare ENCAPSULATE and DECAPSULATE roles, plus an agreement adapter for initiator and responder workflows.
  • Provide a KemContext bound to a public or private key for encapsulation or decapsulation.
  • Expose immutable key-generation specifications and defensively copying encoded-key carriers with simple marshalling helpers; private-key carriers are destroyable.
  • Ensure operations use a supported PQC provider and fail fast if the provider is absent.

Components

  • HqcAlgorithm: algorithm descriptor wiring KEM and agreement roles and registering key builders.
  • HqcKemContext: runtime context implementing encapsulate and decapsulate operations.
  • HqcKeyGenSpec: specification of HQC variants (128, 192, 256) with convenience factories.
  • HqcPublicKeySpec and HqcPrivateKeySpec: wrappers over X.509 and PKCS#8 encodings, with defensive copying and compact marshalling utilities.

Design notes

  • Algorithm descriptors are immutable and safe to share across threads.
  • KEM contexts are stateful and not thread-safe; use one context per operation.
  • Encoded key specs preserve the provided encodings without internal parsing and clone byte arrays on input and output.
  • Agreement adapters allow HQC to be composed into message-based exchanges where needed.
Since:
1.0