protected void engineInit(AlgorithmParameterSpec genParamSpec,SecureRandom random) throws InvalidAlgorithmParameterException {
  if (!(genParamSpec instanceof DHGenParameterSpec)) {
    throw new InvalidAlgorithmParameterException("Inappropriate parameter type");
  }
  DHGenParameterSpec dhParamSpec=(DHGenParameterSpec)genParamSpec;
  primeSize=dhParamSpec.getPrimeSize();
  try {
    checkKeySize(primeSize);
  }
 catch (  InvalidParameterException ipe) {
    throw new InvalidAlgorithmParameterException(ipe.getMessage());
  }
  exponentSize=dhParamSpec.getExponentSize();
  if (exponentSize <= 0) {
    throw new InvalidAlgorithmParameterException("Exponent size must be greater than zero");
  }
  if (exponentSize >= primeSize) {
    throw new InvalidAlgorithmParameterException("Exponent size must be less than modulus size");
  }
}

protected void engineInit ( AlgorithmParameterSpec genParamSpec , SecureRandom random ) throws InvalidAlgorithmParameterException { if ( ! ( genParamSpec instanceof DHGenParameterSpec ) ) { throw new InvalidAlgorithmParameterException ( "Inappropriate parameter type" ) ; } DHGenParameterSpec dhParamSpec = ( DHGenParameterSpec ) genParamSpec ; primeSize = dhParamSpec . getPrimeSize ( ) ; try { checkKeySize ( primeSize ) ; } catch ( InvalidParameterException ipe ) { throw new InvalidAlgorithmParameterException ( ipe . getMessage ( ) ) ; } exponentSize = dhParamSpec . getExponentSize ( ) ; if ( exponentSize <= 0 ) { throw new InvalidAlgorithmParameterException ( "Exponent size must be greater than zero" ) ; } if ( exponentSize >= primeSize ) { throw new InvalidAlgorithmParameterException ( "Exponent size must be less than modulus size" ) ; } }
initializes this parameter generator with a set of parameter generation values , which specify the size of the prime modulus and the size of the random exponent , both in bits .
