Code example for InvalidParameterSpecException

0
        AlgorithmParameterSpec paramSpec)
        throws InvalidParameterSpecException 
    { 
        if (!(paramSpec instanceof IvParameterSpec))
        { 
            throw new InvalidParameterSpecException("IvParameterSpec required to initialise a IV parameters algorithm parameters object");
        } 
 
        this.iv = ((IvParameterSpec)paramSpec).getIV();
    } 
 
    protected void engineInit( 
        byte[] params)
        throws IOException 
    { 
        // 
        // check that we don't have a DER encoded octet string 
        // 
        if ((params.length % 8) != 0
            && params[0] == 0x04 && params[1] == params.length - 2)
        {