Code example for IvParameterSpec

Methods: getIV

0
        } catch(IllegalArgumentException e) { 
            fail("Unexpected IllegalArgumentException was thrown"); 
        } catch(NullPointerException e) { 
            fail("Unexpected NullPointerException was thrown"); 
        } 
        */ 
 
        byte[] iv = new byte[] {1, 2, 3, 4, 5};
        IvParameterSpec ivps = new IvParameterSpec(iv, 0, iv.length);
        iv[0] ++;
        assertFalse("The change of input array's content should not cause "
                    + "the change of internal array", iv[0] == ivps.getIV()[0]);
 
        //Regression for HARMONY-1089 
        try { 
            new IvParameterSpec(new byte[2], 2,  -1);
            fail("ArrayIndexOutOfBoundsException expected");
        } catch (ArrayIndexOutOfBoundsException e) {
            //expected 
        } 
    }