{
DHParameterSpec dhParams = BouncyCastleProvider.CONFIGURATION.getDHDefaultParameters(strength);
if (dhParams != null)
{
param = new ElGamalKeyGenerationParameters(random, new ElGamalParameters(dhParams.getP(), dhParams.getG(), dhParams.getL()));
}
else
{
ElGamalParametersGenerator pGen = new ElGamalParametersGenerator();
pGen.init(strength, certainty, random);
param = new ElGamalKeyGenerationParameters(random, pGen.generateParameters());
}
engine.init(param);
initialised = true;
}