this.p = p.getP(); this.g = p.getG(); } else { this.p = privKey.getParams().getP(); this.g = privKey.getParams().getG(); } this.x = this.result = privKey.getX(); } protected void engineInit( Key key, SecureRandom random) throws InvalidKeyException { if (!(key instanceof DHPrivateKey)) { throw new InvalidKeyException("DHKeyAgreement requires DHPrivateKey");