Code example for InvalidAlgorithmParameterException

0
            } 
            else 
            { 
                throw new InvalidAlgorithmParameterException("PBE requires PBE parameters to be set.");
            } 
        } 
        else 
        { 
            param = new KeyParameter(key.getEncoded());
        } 
 
        if (params instanceof javax.crypto.spec.IvParameterSpec)
        { 
            IvParameterSpec iv = (IvParameterSpec) params;
            param = new ParametersWithIV(param, iv.getIV());
        } 
 
        if (param instanceof KeyParameter && ivSize != 0)
        { 
            iv = new byte[ivSize];
            random.nextBytes(iv);