Code example for InvalidAlgorithmParameterException

            AlgorithmParameterSpec  genParamSpec,
            SecureRandom            random)
            throws InvalidAlgorithmParameterException 
            if (!(genParamSpec instanceof DHGenParameterSpec))
                throw new InvalidAlgorithmParameterException("DH parameter generator requires a DHGenParameterSpec for initialisation");
            DHGenParameterSpec  spec = (DHGenParameterSpec)genParamSpec;
            this.strength = spec.getPrimeSize();
            this.l = spec.getExponentSize();
            this.random = random;
        protected AlgorithmParameters engineGenerateParameters()
            DHParametersGenerator        pGen = new DHParametersGenerator();
            if (random != null)
Connect your IDE to all the code out there  Get Codota for Java