int effectiveKeyBits = 10;
byte[] iv = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
int offset = 2;
try {
new RC2ParameterSpec(effectiveKeyBits, null, offset);
fail("An IllegalArgumentException should be thrown "
+ "in the case of null iv.");
} catch (IllegalArgumentException e) {
}
try {
new RC2ParameterSpec(effectiveKeyBits, iv, 4);
fail("An IllegalArgumentException should be thrown "
+ "in the case of short iv.");
} catch (IllegalArgumentException e) {
}
RC2ParameterSpec ps = new RC2ParameterSpec(effectiveKeyBits, iv, offset);
iv[offset] ++;
assertFalse("The change of iv specified in the constructor "
+ "should not cause the change of internal array.",
iv[offset] == ps.getIV()[0]);
}