FileDocCategorySizeDatePackage
JCEKeyGenerator.javaAPI DocAndroid 1.5 API11311Wed May 06 22:41:06 BST 2009org.bouncycastle.jce.provider

JCEKeyGenerator

public class JCEKeyGenerator extends KeyGeneratorSpi

Fields Summary
protected String
algName
protected int
keySize
protected int
defaultKeySize
protected org.bouncycastle.crypto.CipherKeyGenerator
engine
protected boolean
uninitialised
Constructors Summary
protected JCEKeyGenerator(String algName, int defaultKeySize, org.bouncycastle.crypto.CipherKeyGenerator engine)


     
                      
                         
          
    
        this.algName = algName;
        this.keySize = this.defaultKeySize = defaultKeySize;
        this.engine = engine;
    
Methods Summary
protected javax.crypto.SecretKeyengineGenerateKey()

        if (uninitialised)
        {
            engine.init(new KeyGenerationParameters(
                                    new SecureRandom(), defaultKeySize));
        }

        return (SecretKey)(new SecretKeySpec(engine.generateKey(), algName));
    
protected voidengineInit(java.security.spec.AlgorithmParameterSpec params, java.security.SecureRandom random)

        throw new InvalidAlgorithmParameterException("Not Implemented");
    
protected voidengineInit(java.security.SecureRandom random)

        if (random != null)
        {
            uninitialised = false;
    
            engine.init(new KeyGenerationParameters(random, defaultKeySize));
        }
    
protected voidengineInit(int keySize, java.security.SecureRandom random)

        uninitialised = false;

        try
        {
            engine.init(new KeyGenerationParameters(random, keySize));
        }
        catch (IllegalArgumentException e)
        {
            throw new InvalidParameterException(e.getMessage());
        }