Package zeroecho.core.alg.cmce


package zeroecho.core.alg.cmce
Classic McEliece (CMCE) KEM integration and utilities.

This package adapts the Bouncy Castle PQC CMCE primitives to the core SPI. It provides the algorithm descriptor, a runtime KEM context, and key specifications for generation and import. The design keeps provider-specific details encapsulated behind factories while exposing clear roles and metadata to the higher layers.

Scope and responsibilities

  • Expose a concrete algorithm descriptor that registers CMCE KEM roles and a KEM-backed message-agreement adapter.
  • Provide a runtime context that performs encapsulation and decapsulation.
  • Define key specifications for key-pair generation and for importing X.509 and PKCS#8 encodings.

Components

  • Algorithm descriptor: CmceAlgorithm declares ENCAPSULATE/DECAPSULATE KEM roles and wires an AGREEMENT role through a KEM-based adapter. It also registers asymmetric key builders for generation and import. The provider requirement is the Bouncy Castle provider under the standard name "BC".
  • Runtime context: CmceKemContext holds state for encapsulation or decapsulation depending on which constructor is used.
  • Key generation spec: CmceKeyGenSpec selects a CMCE parameter set (variant) used by the key-pair builder.
  • Key import specs: CmcePublicKeySpec wraps X.509 public keys and CmcePrivateKeySpec wraps PKCS#8 private keys; both defensively copy their byte arrays, and the private-key form is destroyable.

Provider requirements

The algorithm expects the Bouncy Castle provider to be installed before use; the descriptor verifies this when generating or importing keys.

Thread-safety

  • Algorithm descriptors are immutable and safe to share across threads.
  • Runtime contexts are stateful and not thread-safe.
Since:
1.0