Class SecretKeyGenerator

java.lang.Object
org.cryptacular.generator.SecretKeyGenerator

public final class SecretKeyGenerator extends Object
Factory class with static methods for generating SecretKeys.
Author:
Middleware Services
  • Method Summary

    Modifier and Type
    Method
    Description
    static SecretKey
    generate(int bitLength, org.bouncycastle.crypto.BlockCipher cipher)
    Generates a symmetric encryption key of the given length.
    static SecretKey
    generate(int bitLength, org.bouncycastle.crypto.BlockCipher cipher, SecureRandom random)
    Generates a symmetric encryption key of the given length.
    static SecretKey
    generate(org.bouncycastle.crypto.BlockCipher cipher)
    Generates a symmetric encryption key whose size is equal to the cipher block size.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • generate

      public static SecretKey generate(org.bouncycastle.crypto.BlockCipher cipher)
      Generates a symmetric encryption key whose size is equal to the cipher block size.
      Parameters:
      cipher - Cipher with with key will be used.
      Returns:
      Symmetric encryption key.
    • generate

      public static SecretKey generate(int bitLength, org.bouncycastle.crypto.BlockCipher cipher)
      Generates a symmetric encryption key of the given length.
      Parameters:
      bitLength - Desired key length in bits.
      cipher - Cipher with with key will be used.
      Returns:
      Symmetric encryption key.
    • generate

      public static SecretKey generate(int bitLength, org.bouncycastle.crypto.BlockCipher cipher, SecureRandom random)
      Generates a symmetric encryption key of the given length.
      Parameters:
      bitLength - Desired key length in bits.
      cipher - Cipher with with key will be used.
      random - Randomness provider for key generation.
      Returns:
      Symmetric encryption key.