Package org.cryptacular.generator
Class SecretKeyGenerator
java.lang.Object
org.cryptacular.generator.SecretKeyGenerator
Factory class with static methods for generating
SecretKey
s.- Author:
- Middleware Services
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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.
-
Method Details
-
generate
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
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.
-