protected static AsymmetricCipherKeyPair generateDHKeyPair(){
  try {
    KeyGenerationParameters kgp=new DHKeyGenerationParameters(random,DH_GROUP_PARAMETERS);
    DHKeyPairGenerator gen=new DHKeyPairGenerator();
    gen.init(kgp);
    return gen.generateKeyPair();
  }
 catch (  InvalidParameterException e) {
    log.error("InvalidParameterException while generating a Diffie-Hellman keypair " + e);
  }
  return null;
}

protected static AsymmetricCipherKeyPair generateDHKeyPair ( ) { try { KeyGenerationParameters kgp = new DHKeyGenerationParameters ( random , DH_GROUP_PARAMETERS ) ; DHKeyPairGenerator gen = new DHKeyPairGenerator ( ) ; gen . init ( kgp ) ; return gen . generateKeyPair ( ) ; } catch ( InvalidParameterException e ) { log . error ( "InvalidParameterException while generating a Diffie-Hellman keypair " + e ) ; } return null ; }
generates a diffie - hellman keypair of the default size .
