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,SHA224.KeyGenerator,SHA256.KeyGenerator,SHA384.KeyGenerator,SHA512.KeyGenerator
public class BaseKeyGenerator extends KeyGeneratorSpi
-
-
Field Summary
Fields Modifier and Type Field Description protected StringalgNameprotected intdefaultKeySizeprotected CipherKeyGeneratorengineprotected intkeySizeprotected booleanuninitialised
-
Constructor Summary
Constructors Modifier Constructor Description protectedBaseKeyGenerator(String algName, int defaultKeySize, CipherKeyGenerator engine)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected SecretKeyengineGenerateKey()Generates a secret key.protected voidengineInit(int keySize, SecureRandom random)Initializes thisKeyGeneratorinstance for the specified key size (in bits) using the specified randomness source.protected voidengineInit(SecureRandom random)Initializes thisKeyGeneratorwith the specified randomness source.protected voidengineInit(AlgorithmParameterSpec params, SecureRandom random)Initializes thisKeyGeneratorSpiinstance with the specified algorithm parameters and randomness source.
-
-
-
Field Detail
-
algName
protected String algName
-
keySize
protected int keySize
-
defaultKeySize
protected int defaultKeySize
-
engine
protected CipherKeyGenerator engine
-
uninitialised
protected boolean uninitialised
-
-
Constructor Detail
-
BaseKeyGenerator
protected BaseKeyGenerator(String algName, int defaultKeySize, CipherKeyGenerator engine)
-
-
Method Detail
-
engineInit
protected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException
Description copied from class:KeyGeneratorSpiInitializes thisKeyGeneratorSpiinstance with the specified algorithm parameters and randomness source.- Specified by:
engineInitin classKeyGeneratorSpi- 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:KeyGeneratorSpiInitializes thisKeyGeneratorwith the specified randomness source.- Specified by:
engineInitin classKeyGeneratorSpi- Parameters:
random- the randomness source for any random bytes.
-
engineInit
protected void engineInit(int keySize, SecureRandom random)Description copied from class:KeyGeneratorSpiInitializes thisKeyGeneratorinstance for the specified key size (in bits) using the specified randomness source.- Specified by:
engineInitin classKeyGeneratorSpi- 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:KeyGeneratorSpiGenerates a secret key.- Specified by:
engineGenerateKeyin classKeyGeneratorSpi- Returns:
- the generated secret key.
-
-