use of org.bouncycastle.crypto.AsymmetricCipherKeyPair in project Skein3Fish by wernerd.
the class DHKeyPairGenerator method generateKeyPair.
public AsymmetricCipherKeyPair generateKeyPair() {
DHKeyGeneratorHelper helper = DHKeyGeneratorHelper.INSTANCE;
DHParameters dhp = param.getParameters();
BigInteger x = helper.calculatePrivate(dhp, param.getRandom());
BigInteger y = helper.calculatePublic(dhp, x);
return new AsymmetricCipherKeyPair(new DHPublicKeyParameters(y, dhp), new DHPrivateKeyParameters(x, dhp));
}
use of org.bouncycastle.crypto.AsymmetricCipherKeyPair 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.AsymmetricCipherKeyPair in project robovm by robovm.
the class KeyPairGeneratorSpi method generateKeyPair.
public KeyPair generateKeyPair() {
AsymmetricCipherKeyPair pair = engine.generateKeyPair();
RSAKeyParameters pub = (RSAKeyParameters) pair.getPublic();
RSAPrivateCrtKeyParameters priv = (RSAPrivateCrtKeyParameters) pair.getPrivate();
return new KeyPair(new BCRSAPublicKey(pub), new BCRSAPrivateCrtKey(priv));
}
Aggregations