@Test public void testGenIVLength() throws InvalidKeyException, InvalidAlgorithmParameterException { int i = 4; CryptByteBuffer crypt = new CryptByteBuffer(cipherTypes[i], keys[i], ivs[i]); assertEquals(crypt.genIV().getIV().length, cipherTypes[i].ivSize.intValue()); }
@Test public void testGenIV() throws InvalidKeyException, InvalidAlgorithmParameterException { int i = 4; CryptByteBuffer crypt = new CryptByteBuffer(cipherTypes[i], keys[i], ivs[i]); assertNotNull(crypt.genIV()); }
@Test (expected = UnsupportedTypeException.class) public void testGenIVUnsupportedTypeException() throws GeneralSecurityException { int i = 1; CryptByteBuffer crypt = new CryptByteBuffer(cipherTypes[i], keys[i]); crypt.genIV(); fail("Expected UnsupportedTypeException"); }
@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()); }