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

org.bouncycastle.crypto

## Class CipherKeyGenerator

- java.lang.Object
- - org.bouncycastle.crypto.CipherKeyGenerator

- Direct Known Subclasses:
    DESKeyGenerator, Poly1305KeyGenerator

      public class CipherKeyGenerator
      extends java.lang.Object

  The base class for symmetric, or secret, cipher key generators.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.security.SecureRandom` | `random`
    `protected int` | `strength`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CipherKeyGenerator()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `generateKey()` generate a secret key.
    `void` | `init(KeyGenerationParameters param)` initialise the key generator.

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

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

- - ### Field Detail

    - #### random

          protected java.security.SecureRandom random

    - #### strength

          protected int strength

  - ### Constructor Detail

    - #### CipherKeyGenerator

          public CipherKeyGenerator()

  - ### Method Detail

    - #### init

          public void init(KeyGenerationParameters param)

      initialise the key generator.
      Parameters:
        `param` - the parameters to be used for key generation

    - #### generateKey

          public byte[] generateKey()

      generate a secret key.
      Returns:
        a byte array containing the key value.