public static void initDHKeys(DistributionConfig config) throws Exception {
  dhSKAlgo=config.getSecurityClientDHAlgo();
  dhPrivateKey=null;
  dhPublicKey=null;
  if ((dhSKAlgo != null && dhSKAlgo.length() > 0) || securityService.isClientSecurityRequired()) {
    KeyPairGenerator keyGen=KeyPairGenerator.getInstance("DH");
    DHParameterSpec dhSpec=new DHParameterSpec(dhP,dhG,dhL);
    keyGen.initialize(dhSpec);
    KeyPair keypair=keyGen.generateKeyPair();
    dhPrivateKey=keypair.getPrivate();
    dhPublicKey=keypair.getPublic();
    random=new SecureRandom();
    byte[] someBytes=new byte[48];
    random.nextBytes(someBytes);
  }
}

public static void initDHKeys ( DistributionConfig config ) throws Exception { dhSKAlgo = config . getSecurityClientDHAlgo ( ) ; dhPrivateKey = null ; dhPublicKey = null ; if ( ( dhSKAlgo != null && dhSKAlgo . length ( ) > 0 ) || securityService . isClientSecurityRequired ( ) ) { KeyPairGenerator keyGen = KeyPairGenerator . getInstance ( "DH" ) ; DHParameterSpec dhSpec = new DHParameterSpec ( dhP , dhG , dhL ) ; keyGen . initialize ( dhSpec ) ; KeyPair keypair = keyGen . generateKeyPair ( ) ; dhPrivateKey = keypair . getPrivate ( ) ; dhPublicKey = keypair . getPublic ( ) ; random = new SecureRandom ( ) ; byte [ ] someBytes = new byte [ 48 ] ; random . nextBytes ( someBytes ) ; } }
initialize the diffie - hellman keys . this method is not thread safe
