@Test public void doCTRDecrypt() { for (String[] example : CTRExample) { byte[] decrypt = AES.decryptByCTR(NumericUtil.hexToBytes(example[0]), NumericUtil.hexToBytes(example[2]), NumericUtil.hexToBytes(example[3])); assertEquals(example[1], NumericUtil.bytesToHex(decrypt)); } }
public static byte[] decryptByCTR(byte[] ciphertext, byte[] key, byte[] iv) { return doAES(ciphertext, key, iv, Cipher.DECRYPT_MODE, AESType.CTR, "PKCS5Padding"); }
AES { public static byte[] decryptByCTR(byte[] ciphertext, byte[] key, byte[] iv) { return doAES(ciphertext, key, iv, Cipher.DECRYPT_MODE, AESType.CTR, "PKCS5Padding"); } }
AES { public static byte[] decryptByCTR(byte[] ciphertext, byte[] key, byte[] iv) { return doAES(ciphertext, key, iv, Cipher.DECRYPT_MODE, AESType.CTR, "PKCS5Padding"); }  }
AES { public static byte[] decryptByCTR(byte[] ciphertext, byte[] key, byte[] iv) { return doAES(ciphertext, key, iv, Cipher.DECRYPT_MODE, AESType.CTR, "PKCS5Padding"); }  static byte[] encryptByCTR(byte[] data, byte[] key, byte[] iv); static byte[] decryptByCTR(byte[] ciphertext, byte[] key, byte[] iv); static byte[] encryptByCBC(byte[] data, byte[] key, byte[] iv); static byte[] decryptByCBC(byte[] ciphertext, byte[] key, byte[] iv); static byte[] encryptByCTRNoPadding(byte[] data, byte[] key, byte[] iv); static byte[] decryptByCTRNoPadding(byte[] ciphertext, byte[] key, byte[] iv); static byte[] encryptByCBCNoPadding(byte[] data, byte[] key, byte[] iv); static byte[] decryptByCBCNoPadding(byte[] ciphertext, byte[] key, byte[] iv); }
AES { public static byte[] decryptByCTR(byte[] ciphertext, byte[] key, byte[] iv) { return doAES(ciphertext, key, iv, Cipher.DECRYPT_MODE, AESType.CTR, "PKCS5Padding"); }  static byte[] encryptByCTR(byte[] data, byte[] key, byte[] iv); static byte[] decryptByCTR(byte[] ciphertext, byte[] key, byte[] iv); static byte[] encryptByCBC(byte[] data, byte[] key, byte[] iv); static byte[] decryptByCBC(byte[] ciphertext, byte[] key, byte[] iv); static byte[] encryptByCTRNoPadding(byte[] data, byte[] key, byte[] iv); static byte[] decryptByCTRNoPadding(byte[] ciphertext, byte[] key, byte[] iv); static byte[] encryptByCBCNoPadding(byte[] data, byte[] key, byte[] iv); static byte[] decryptByCBCNoPadding(byte[] ciphertext, byte[] key, byte[] iv);  }