mt.nextBytes(plaintext);
mt.nextBytes(key);
mt.nextBytes(iv);
SecretKeySpec k = new SecretKeySpec(key, "AES");
Cipher c = Cipher.getInstance("AES/CTR/NOPADDING", Rijndael.AesCtrProvider);
c.init(Cipher.ENCRYPT_MODE, k, new IvParameterSpec(iv));
byte[] output = c.doFinal(plaintext);
c = Cipher.getInstance("AES/CTR/NOPADDING", Rijndael.AesCtrProvider);
c.init(Cipher.DECRYPT_MODE, k, new IvParameterSpec(iv));
byte[] decrypted = c.doFinal(output);
assertTrue(Arrays.equals(decrypted, plaintext));
}
}