NTRUParameterSet (Bouncy Castle Library 1.85 API Specification)
Date: 2026-07-12

org.bouncycastle.pqc.math.ntru.parameters

## Class NTRUParameterSet

- java.lang.Object
- - org.bouncycastle.pqc.math.ntru.parameters.NTRUParameterSet

- Direct Known Subclasses:
    NTRUHPSParameterSet, NTRUHRSSParameterSet

      public abstract class NTRUParameterSet
      extends java.lang.Object

  Abstract class for all NTRU parameter sets.
  See Also:
    `NTRUHPSParameterSet`, `NTRUHRSSParameterSet`, NTRU specification document

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `NTRUParameterSet(int n, int logQ, int seedBytes, int prfKeyBytes, int sharedKeyBytes)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract Polynomial` | `createPolynomial()` Creates a polynomial based on this parameter set.
    `int` | `logQ()` logq
    `int` | `n()` n
    `int` | `ntruCiphertextBytes()` The number of bytes in a ciphertext for the KEM.
    `int` | `ntruPublicKeyBytes()` The number of bytes in a public key for the KEM.
    `int` | `ntruSecretKeyBytes()` The number of bytes in a private key for the KEM.
    `int` | `owcpaBytes()` The number of bytes in a ciphertext for the DPKE.
    `int` | `owcpaMsgBytes()` The number of bytes in a plaintext for the DPKE.
    `int` | `owcpaPublicKeyBytes()` The number of bytes in a public key for the DPKE.
    `int` | `owcpaSecretKeyBytes()` The number of bytes in a private key for the DPKE.
    `int` | `packDegree()`
    `int` | `packTrinaryBytes()`
    `int` | `prfKeyBytes()` The number of bytes used to key the implicit rejection mechanism.
    `int` | `q()` q
    `abstract int` | `sampleFgBytes()`
    `int` | `sampleFixedTypeBytes()`
    `int` | `sampleIidBytes()`
    `abstract int` | `sampleRmBytes()`
    `int` | `seedBytes()` The number of random bytes consumed by keygen.
    `int` | `sharedKeyBytes()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### NTRUParameterSet

          public NTRUParameterSet(int n,
                                  int logQ,
                                  int seedBytes,
                                  int prfKeyBytes,
                                  int sharedKeyBytes)

  - ### Method Detail

    - #### createPolynomial

          public abstract Polynomial createPolynomial()

      Creates a polynomial based on this parameter set.
      Returns:
        an instance of `Polynomial`

    - #### n

          public int n()

      n
      Returns:
        n is a prime and both 2 and 3 are of order n − 1 in (Z/n)×

    - #### logQ

          public int logQ()

      logq
      Returns:
        log2(q)

    - #### q

          public int q()

      q
      Returns:
        q is a power of two

    - #### seedBytes

          public int seedBytes()

      The number of random bytes consumed by keygen.
      Returns:
        `key_seed_bits/8`

    - #### prfKeyBytes

          public int prfKeyBytes()

      The number of bytes used to key the implicit rejection mechanism.
      Returns:
        `prf_key_bits/8`

    - #### sharedKeyBytes

          public int sharedKeyBytes()

      Returns:
        `kem_shared_key_bits/8`

    - #### sampleIidBytes

          public int sampleIidBytes()

      Returns:
        `sample_iid_bits/8`

    - #### sampleFixedTypeBytes

          public int sampleFixedTypeBytes()

      Returns:
        `sample_xed_type_bits`

    - #### sampleFgBytes

          public abstract int sampleFgBytes()

      Returns:
        `sample_key_bits/8`

    - #### sampleRmBytes

          public abstract int sampleRmBytes()

      Returns:
        `sample_plaintext_bits/8`

    - #### packDegree

          public int packDegree()

    - #### packTrinaryBytes

          public int packTrinaryBytes()

      Returns:
        `packed_s3_bytes`

    - #### owcpaMsgBytes

          public int owcpaMsgBytes()

      The number of bytes in a plaintext for the DPKE.
      Returns:
        `dpke_plaintext_bytes`

    - #### owcpaPublicKeyBytes

          public int owcpaPublicKeyBytes()

      The number of bytes in a public key for the DPKE.
      Returns:
        `dpke_public_key_bytes`

    - #### owcpaSecretKeyBytes

          public int owcpaSecretKeyBytes()

      The number of bytes in a private key for the DPKE.
      Returns:
        `dpke_private_key_bytes`

    - #### owcpaBytes

          public int owcpaBytes()

      The number of bytes in a ciphertext for the DPKE.
      Returns:
        `dpke_ciphertext_bytes`

    - #### ntruPublicKeyBytes

          public int ntruPublicKeyBytes()

      The number of bytes in a public key for the KEM.
      Returns:
        `kem_public_key_bytes`

    - #### ntruSecretKeyBytes

          public int ntruSecretKeyBytes()

      The number of bytes in a private key for the KEM.
      Returns:
        `kem_private_key_bytes`

    - #### ntruCiphertextBytes

          public int ntruCiphertextBytes()

      The number of bytes in a ciphertext for the KEM.
      Returns:
        `kem_ciphertext_bytes`