FileDocCategorySizeDatePackage
CipherKeyGenerator.javaAPI DocAzureus 3.0.3.4797Tue Jun 08 05:12:58 BST 2004org.bouncycastle.crypto

CipherKeyGenerator

public class CipherKeyGenerator extends Object
The base class for symmetric, or secret, cipher key generators.

Fields Summary
protected SecureRandom
random
protected int
strength
Constructors Summary
Methods Summary
public byte[]generateKey()
generate a secret key.

return
a byte array containing the key value.

        byte[]  key = new byte[strength];

        random.nextBytes(key);

        return key;
    
public voidinit(KeyGenerationParameters param)
initialise the key generator.

param
param the parameters to be used for key generation

        this.random = param.getRandom();
        this.strength = (param.getStrength() + 7) / 8;