@Test public void testDecryptByECB() { String base64Key = "F51riKYgKK8PRrt+5IC6CQ=="; byte[] key = Base64Util.decryptBASE64(base64Key); System.out.println("key:" + new String(key)); byte[] content = "hello".getBytes(); byte[] encodeResult = AESUtil.encryptByECB(content, key); System.out.println("after encode:" + Base64Util.encryptToString(encodeResult)); byte[] result = AESUtil.decryptByECB(encodeResult, key); System.out.println("after decode:" + new String(result)); String result2 = AESUtil.decodeByECB(Base64Util.encryptToString(encodeResult), new String(key)); System.out.println(result2); }
public static byte[] decryptByECB(byte[] content, byte[] key) { return decryptByECB(content, key, AesPaddings.AES_ECB_PKCS5); }
AESUtil { public static byte[] decryptByECB(byte[] content, byte[] key) { return decryptByECB(content, key, AesPaddings.AES_ECB_PKCS5); } }
AESUtil { public static byte[] decryptByECB(byte[] content, byte[] key) { return decryptByECB(content, key, AesPaddings.AES_ECB_PKCS5); }  }
AESUtil { public static byte[] decryptByECB(byte[] content, byte[] key) { return decryptByECB(content, key, AesPaddings.AES_ECB_PKCS5); }  static byte[] decryptByCBC(byte[] content, byte[] key, byte[] initVector); static byte[] decryptByCBC(byte[] content, byte[] key, byte[] initVector, String padding); static byte[] encryptByCBC(byte[] content, byte[] key, byte[] initVector); static byte[] encryptByCBC(byte[] content, byte[] key, byte[] initVector, String padding); static byte[] decryptByECB(byte[] content, byte[] key); static byte[] decryptByECB(byte[] content, byte[] key, String padding); static byte[] encryptByECB(byte[] content, byte[] key); static byte[] encryptByECB(byte[] content, byte[] key, String padding); static String decodeByCBC(String content, String key, String initVector); static String decodeByCBC(String content, String key, String initVector, String padding); static String decodeByCBCBase64(String content, String key, String initVector, String padding); static String encodeByCBC(String content, String key, String initVector); static String encodeByCBC(String content, String key, String initVector, String padding); static String encodeByCBCBase64(String content, String key, String initVector, String padding); static String encodeByECB(String content, String key); static String encodeByECB(String content, String key, String padding); static String decodeByECB(String content, String key); }
AESUtil { public static byte[] decryptByECB(byte[] content, byte[] key) { return decryptByECB(content, key, AesPaddings.AES_ECB_PKCS5); }  static byte[] decryptByCBC(byte[] content, byte[] key, byte[] initVector); static byte[] decryptByCBC(byte[] content, byte[] key, byte[] initVector, String padding); static byte[] encryptByCBC(byte[] content, byte[] key, byte[] initVector); static byte[] encryptByCBC(byte[] content, byte[] key, byte[] initVector, String padding); static byte[] decryptByECB(byte[] content, byte[] key); static byte[] decryptByECB(byte[] content, byte[] key, String padding); static byte[] encryptByECB(byte[] content, byte[] key); static byte[] encryptByECB(byte[] content, byte[] key, String padding); static String decodeByCBC(String content, String key, String initVector); static String decodeByCBC(String content, String key, String initVector, String padding); static String decodeByCBCBase64(String content, String key, String initVector, String padding); static String encodeByCBC(String content, String key, String initVector); static String encodeByCBC(String content, String key, String initVector, String padding); static String encodeByCBCBase64(String content, String key, String initVector, String padding); static String encodeByECB(String content, String key); static String encodeByECB(String content, String key, String padding); static String decodeByECB(String content, String key);  }