35363738394041
BigInteger x = helper.calculatePrivate(dhp, param.getRandom()); BigInteger y = helper.calculatePublic(dhp, x); return new AsymmetricCipherKeyPair( new DHPublicKeyParameters(y, dhp), new DHPrivateKeyParameters(x, dhp)); }
185186187188189190191192193194
initialised = true; } AsymmetricCipherKeyPair pair = engine.generateKeyPair(); DHPublicKeyParameters pub = (DHPublicKeyParameters)pair.getPublic(); DHPrivateKeyParameters priv = (DHPrivateKeyParameters)pair.getPrivate(); return new KeyPair(new JCEDHPublicKey(pub), new JCEDHPrivateKey(priv)); }
189190191192193194195196197198
38394041424344
x = helper.calculatePrivate(p, param.getRandom(), dhParams.getL()); y = helper.calculatePublic(p, dhParams.getG(), x); return new AsymmetricCipherKeyPair( new DHPublicKeyParameters(y, dhParams), new DHPrivateKeyParameters(x, dhParams)); }
x = helper.calculatePrivate(p, param.getRandom(), dhParams.getJ()); y = helper.calculatePublic(p, dhParams.getG(), x); return new AsymmetricCipherKeyPair( new DHPublicKeyParameters(y, dhParams), new DHPrivateKeyParameters(x, dhParams)); }
37383940414243
3940414243444546474849
{ if (key instanceof DHPrivateKey) { DHPrivateKey k = (DHPrivateKey)key; return new DHPrivateKeyParameters(k.getX(), new DHParameters(k.getParams().getP(), k.getParams().getG(), null, k.getParams().getL())); } throw new InvalidKeyException("can't identify DH private key."); }