use of org.bouncycastle.crypto.params.DSAKeyGenerationParameters in project robovm by robovm.
the class KeyPairGeneratorSpi method generateKeyPair.
public KeyPair generateKeyPair() {
if (!initialised) {
DSAParametersGenerator pGen = new DSAParametersGenerator();
pGen.init(strength, certainty, random);
param = new DSAKeyGenerationParameters(random, pGen.generateParameters());
engine.init(param);
initialised = true;
}
AsymmetricCipherKeyPair pair = engine.generateKeyPair();
DSAPublicKeyParameters pub = (DSAPublicKeyParameters) pair.getPublic();
DSAPrivateKeyParameters priv = (DSAPrivateKeyParameters) pair.getPrivate();
return new KeyPair(new BCDSAPublicKey(pub), new BCDSAPrivateKey(priv));
}
use of org.bouncycastle.crypto.params.DSAKeyGenerationParameters in project robovm by robovm.
the class KeyPairGeneratorSpi method initialize.
public void initialize(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException {
if (!(params instanceof DSAParameterSpec)) {
throw new InvalidAlgorithmParameterException("parameter object not a DSAParameterSpec");
}
DSAParameterSpec dsaParams = (DSAParameterSpec) params;
param = new DSAKeyGenerationParameters(random, new DSAParameters(dsaParams.getP(), dsaParams.getQ(), dsaParams.getG()));
engine.init(param);
initialised = true;
}
Aggregations