Code example for InvalidParameterException

0
        protected void engineInit( 
            int             strength,
            SecureRandom    random)
        { 
            if (strength < 512 || strength > 1024 || strength % 64 != 0)
            { 
                throw new InvalidParameterException("strength must be from 512 - 1024 and a multiple of 64");
            } 
 
            this.strength = strength;
            this.random = random;
        } 
 
        protected void engineInit( 
            AlgorithmParameterSpec  genParamSpec,
            SecureRandom            random)
            throws InvalidAlgorithmParameterException 
        { 
            throw new InvalidAlgorithmParameterException("No supported AlgorithmParameterSpec for DSA parameter generation.");
        }