Code example for InvalidAlgorithmParameterException

0
            SecureRandom            random)
            throws InvalidAlgorithmParameterException 
        { 
            if (!(params instanceof DHParameterSpec))
            { 
                throw new InvalidAlgorithmParameterException("parameter object not a DHParameterSpec");
            } 
            DHParameterSpec     dhParams = (DHParameterSpec)params;
 
            param = new DHKeyGenerationParameters(random, new DHParameters(dhParams.getP(), dhParams.getG(), null, dhParams.getL()));
 
            engine.init(param);
            initialised = true;
        } 
 
        public KeyPair generateKeyPair()
        { 
            if (!initialised)
            { 
                // BEGIN android-changed 
                Integer paramStrength = Integer.valueOf(strength);