@Test (expected = UnsupportedTypeException.class) public void testSetIVIvParameterSpecUnsupportedTypeException() throws GeneralSecurityException { int i = 0; CryptByteBuffer crypt = new CryptByteBuffer(cipherTypes[i], keys[i]); crypt.setIV(new IvParameterSpec(ivs[4])); fail("Expected UnsupportedTypeException"); }
@Test public void testSetIVIvParameterSpecNullInput() throws InvalidKeyException, InvalidAlgorithmParameterException { IvParameterSpec nullInput = null; int i = 4; CryptByteBuffer crypt = new CryptByteBuffer(cipherTypes[i], keys[i], ivs[i]); try{ crypt.setIV(nullInput); fail("Expected InvalidAlgorithmParameterException"); } catch (InvalidAlgorithmParameterException e){} }
@Test public void testSetIVIvParameterSpec() throws InvalidKeyException, InvalidAlgorithmParameterException { int i = 4; CryptByteBuffer crypt = new CryptByteBuffer(cipherTypes[i], keys[i], ivs[i]); crypt.genIV(); crypt.setIV(new IvParameterSpec(ivs[i])); assertArrayEquals(ivs[i], crypt.getIV().getIV()); }