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

org.bouncycastle.crypto.params

## Class DHParameters

- java.lang.Object
- - org.bouncycastle.crypto.params.DHParameters

- All Implemented Interfaces:
    CipherParameters

      public class DHParameters
      extends java.lang.Object
      implements CipherParameters

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DHParameters(java.math.BigInteger p, java.math.BigInteger g)`
    `DHParameters(java.math.BigInteger p, java.math.BigInteger g, java.math.BigInteger q)`
    `DHParameters(java.math.BigInteger p, java.math.BigInteger g, java.math.BigInteger q, java.math.BigInteger j, DHValidationParameters validation)`
    `DHParameters(java.math.BigInteger p, java.math.BigInteger g, java.math.BigInteger q, int l)`
    `DHParameters(java.math.BigInteger p, java.math.BigInteger g, java.math.BigInteger q, int m, int l)`
    `DHParameters(java.math.BigInteger p, java.math.BigInteger g, java.math.BigInteger q, int m, int l, java.math.BigInteger j, DHValidationParameters validation)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object obj)`
    `java.math.BigInteger` | `getG()`
    `java.math.BigInteger` | `getJ()` Return the subgroup factor J.
    `int` | `getL()` Return the private value length in bits - if set, zero otherwise
    `int` | `getM()` Return the minimum length of the private value.
    `java.math.BigInteger` | `getP()`
    `java.math.BigInteger` | `getQ()`
    `DHValidationParameters` | `getValidationParameters()`
    `int` | `hashCode()`

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

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

- - ### Constructor Detail

    - #### DHParameters

          public DHParameters(java.math.BigInteger p,
                              java.math.BigInteger g)

    - #### DHParameters

          public DHParameters(java.math.BigInteger p,
                              java.math.BigInteger g,
                              java.math.BigInteger q)

    - #### DHParameters

          public DHParameters(java.math.BigInteger p,
                              java.math.BigInteger g,
                              java.math.BigInteger q,
                              int l)

    - #### DHParameters

          public DHParameters(java.math.BigInteger p,
                              java.math.BigInteger g,
                              java.math.BigInteger q,
                              int m,
                              int l)

    - #### DHParameters

          public DHParameters(java.math.BigInteger p,
                              java.math.BigInteger g,
                              java.math.BigInteger q,
                              java.math.BigInteger j,
                              DHValidationParameters validation)

    - #### DHParameters

          public DHParameters(java.math.BigInteger p,
                              java.math.BigInteger g,
                              java.math.BigInteger q,
                              int m,
                              int l,
                              java.math.BigInteger j,
                              DHValidationParameters validation)

  - ### Method Detail

    - #### getP

          public java.math.BigInteger getP()

    - #### getG

          public java.math.BigInteger getG()

    - #### getQ

          public java.math.BigInteger getQ()

    - #### getJ

          public java.math.BigInteger getJ()

      Return the subgroup factor J.
      Returns:
        subgroup factor

    - #### getM

          public int getM()

      Return the minimum length of the private value.
      Returns:
        the minimum length of the private value in bits.

    - #### getL

          public int getL()

      Return the private value length in bits - if set, zero otherwise
      Returns:
        the private value length in bits, zero otherwise.

    - #### getValidationParameters

          public DHValidationParameters getValidationParameters()

    - #### equals

          public boolean equals(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`