private void testOldCTS( int id, BlockCipher cipher, CipherParameters params, byte[] input, byte[] output) throws Exception { byte[] out = new byte[input.length]; BufferedBlockCipher engine = new OldCTSBlockCipher(cipher); engine.init(true, params); int len = engine.processBytes(input, 0, input.length, out, 0); engine.doFinal(out, len); if (!areEqual(output, out)) { fail("failed encryption expected " + new String(Hex.encode(output)) + " got " + new String(Hex.encode(out))); } engine.init(false, params); len = engine.processBytes(output, 0, output.length, out, 0); engine.doFinal(out, len); if (!areEqual(input, out)) { fail("failed decryption expected " + new String(Hex.encode(input)) + " got " + new String(Hex.encode(out))); } }