Class BaseKeyGenerator

java.lang.Object
javax.crypto.KeyGeneratorSpi
org.bouncycastle.jcajce.provider.symmetric.util.BaseKeyGenerator
Direct Known Subclasses:
AES.KeyGen, ARC4.KeyGen, Blowfish.KeyGen, DES.KeyGenerator, DESede.KeyGenerator, DESede.KeyGenerator3, MD5.KeyGenerator, SHA1.KeyGenerator, SHA256.KeyGenerator, SHA384.KeyGenerator, SHA512.KeyGenerator

public class BaseKeyGenerator
extends KeyGeneratorSpi
  • Field Details

    • algName

      protected String algName
    • keySize

      protected int keySize
    • defaultKeySize

      protected int defaultKeySize
    • engine

      protected CipherKeyGenerator engine
    • uninitialised

      protected boolean uninitialised
  • Constructor Details

  • Method Details

    • engineInit

      protected void engineInit​(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException
      Description copied from class: KeyGeneratorSpi
      Initializes this KeyGeneratorSpi instance with the specified algorithm parameters and randomness source.
      Specified by:
      engineInit in class KeyGeneratorSpi
      Parameters:
      params - the parameters for the key generation algorithm.
      random - the randomness source for any random bytes.
      Throws:
      InvalidAlgorithmParameterException - if the parameters cannot be uses to initialize this key generator algorithm.
    • engineInit

      protected void engineInit​(SecureRandom random)
      Description copied from class: KeyGeneratorSpi
      Initializes this KeyGenerator with the specified randomness source.
      Specified by:
      engineInit in class KeyGeneratorSpi
      Parameters:
      random - the randomness source for any random bytes.
    • engineInit

      protected void engineInit​(int keySize, SecureRandom random)
      Description copied from class: KeyGeneratorSpi
      Initializes this KeyGenerator instance for the specified key size (in bits) using the specified randomness source.
      Specified by:
      engineInit in class KeyGeneratorSpi
      Parameters:
      keySize - the size of the key (in bits).
      random - the randomness source for any random bytes.
    • engineGenerateKey

      protected SecretKey engineGenerateKey()
      Description copied from class: KeyGeneratorSpi
      Generates a secret key.
      Specified by:
      engineGenerateKey in class KeyGeneratorSpi
      Returns:
      the generated secret key.