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

org.bouncycastle.crypto.generators

## Class DHKeyPairGenerator

- java.lang.Object
- - org.bouncycastle.crypto.generators.DHKeyPairGenerator

- All Implemented Interfaces:
    AsymmetricCipherKeyPairGenerator

      public class DHKeyPairGenerator
      extends java.lang.Object
      implements AsymmetricCipherKeyPairGenerator

  a Diffie-Hellman key pair generator. This generates keys consistent for use in the MTI/A0 key agreement protocol as described in "Handbook of Applied Cryptography", Pages 516-519.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DHKeyPairGenerator()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `AsymmetricCipherKeyPair` | `generateKeyPair()` return an AsymmetricCipherKeyPair containing the generated keys.
    `void` | `init(KeyGenerationParameters param)` intialise the key pair generator.

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

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

- - ### Constructor Detail

    - #### DHKeyPairGenerator

          public DHKeyPairGenerator()

  - ### Method Detail

    - #### init

          public void init(KeyGenerationParameters param)

      Description copied from interface: `AsymmetricCipherKeyPairGenerator`
      intialise the key pair generator.
      Specified by:
        `init` in interface `AsymmetricCipherKeyPairGenerator`
      Parameters:
        `param` - the parameters the key pair is to be initialised with.

    - #### generateKeyPair

          public AsymmetricCipherKeyPair generateKeyPair()

      Description copied from interface: `AsymmetricCipherKeyPairGenerator`
      return an AsymmetricCipherKeyPair containing the generated keys.
      Specified by:
        `generateKeyPair` in interface `AsymmetricCipherKeyPairGenerator`
      Returns:
        an AsymmetricCipherKeyPair containing the generated keys.