Package zeroecho.core.alg.ntruprime


package zeroecho.core.alg.ntruprime
NTRU Prime family key encapsulation mechanisms and related utilities.

This package integrates the NTRU LPRime and SNTRU Prime post-quantum KEMs into the core layer. It provides algorithm descriptors, runtime KEM contexts, key generation specifications, and encoded key specifications for import and export. Provider-specific details are encapsulated behind small factories while roles and metadata remain explicit to higher layers.

Scope and responsibilities

  • Register canonical algorithms for NTRU LPRime and SNTRU Prime and declare ENCAPSULATE and DECAPSULATE roles, plus an agreement adapter that maps KEM to a message-style initiator/responder API.
  • Provide KemContext implementations bound to a public key (encapsulation) or a private key (decapsulation).
  • Expose immutable key-generation specifications and defensively copying encoded-key carriers with compact marshalling helpers; private-key carriers are destroyable.
  • Validate provider availability and fail fast if the PQC provider is absent.

Components

  • NtrulPrimeAlgorithm and SntruPrimeAlgorithm: algorithm descriptors that wire KEM and agreement roles and register asymmetric key builders for generation and encoded-key import.
  • NtrulPrimeKemContext and SntruPrimeKemContext: runtime contexts implementing encapsulate and decapsulate operations.
  • NtrulPrimeKeyGenSpec / SntruPrimeKeyGenSpec: immutable selection of standardized parameter variants with convenience factories.
  • NtrulPrimePublicKeySpec, NtrulPrimePrivateKeySpec, SntruPrimePublicKeySpec, SntruPrimePrivateKeySpec: wrappers over X.509 and PKCS#8 encodings with defensive copying and simple marshalling utilities.

Provider requirements

All key operations rely on a PQC provider (Bouncy Castle PQC). The provider must be installed in the current JVM before use; otherwise key generation and import fail.

Thread-safety

  • Algorithm descriptors are immutable and safe to share across threads.
  • KEM contexts are stateful and not thread-safe; create one per operation.
  • Encoded key specs clone input and output arrays to avoid leaking internal state.
Since:
1.0
  • Class
    Description
    Configures and exposes the NTRU LPRime post-quantum KEM and a message-agreement adapter backed by the Bouncy Castle PQC provider.
    KEM context for NTRU LPRime that performs encapsulation and decapsulation using the underlying key material.
    Algorithm-specific key generation parameters for NTRU LPRime.
    Enumeration of supported NTRU LPRime parameter sets.
    Specification wrapper for an encoded NTRU LPRime private key in PKCS#8 format.
    Specification wrapper for an encoded NTRU LPRime public key in X.509 format.
    Configures and exposes the SNTRU Prime post-quantum KEM and a message-agreement adapter backed by the Bouncy Castle PQC provider.
    KEM context for SNTRU Prime that performs encapsulation and decapsulation using the underlying key material.
    Algorithm-specific key generation parameters for SNTRU Prime.
    Enumeration of supported SNTRU Prime parameter sets.
    Specification wrapper for an encoded SNTRU Prime private key in PKCS#8 format.
    Specification wrapper for an encoded SNTRU Prime public key in X.509 format.