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

org.bouncycastle.crypto.generators

## Class DSAParametersGenerator

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

-     public class DSAParametersGenerator
      extends java.lang.Object

  Generate suitable parameters for DSA, in line with FIPS 186-2, or FIPS 186-3.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DSAParametersGenerator()`
    `DSAParametersGenerator(Digest digest)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `DSAParameters` | `generateParameters()` which generates the p and g values from the given parameters, returning the DSAParameters object.
    `void` | `init(DSAParameterGenerationParameters params)` Initialise the key generator for DSA 2.
    `void` | `init(int size, int certainty, java.security.SecureRandom random)` initialise the key generator.

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

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

- - ### Constructor Detail

    - #### DSAParametersGenerator

          public DSAParametersGenerator()

    - #### DSAParametersGenerator

          public DSAParametersGenerator(Digest digest)

  - ### Method Detail

    - #### init

          public void init(int size,
                           int certainty,
                           java.security.SecureRandom random)

      initialise the key generator.
      Parameters:
        `size` - size of the key (range 2^512 -> 2^1024 - 64 bit increments)
        `certainty` - measure of robustness of prime (for FIPS 186-2 compliance this should be at least 80).
        `random` - random byte source.

    - #### init

          public void init(DSAParameterGenerationParameters params)

      Initialise the key generator for DSA 2.

      Use this init method if you need to generate parameters for DSA 2 keys.

      Parameters:
        `params` - DSA 2 key generation parameters.

    - #### generateParameters

          public DSAParameters generateParameters()

      which generates the p and g values from the given parameters, returning the DSAParameters object.

      Note: can take a while...

      Returns:
        a generated DSA parameters object.