@Test public void testDecodeByCBCBase64() { String encodeStr = AESUtil.encodeByCBCBase64("hello world", KEY, IV, AesPaddings.AES_CBC_PKCS7); System.out.println("After encode by CBC mode: " + encodeStr); String decodeStr = AESUtil.decodeByCBCBase64(encodeStr, KEY, IV, AesPaddings.AES_CBC_PKCS7); System.out.println("After decode by CBC mode: " + decodeStr); }
public static String decodeByCBCBase64(String content, String key, String initVector, String padding) { AESUtil.checkParamsOfCBC(content, key, initVector); byte[] decryptFrom = Base64Util.decryptBASE64(content); byte[] decryptResult = decryptByCBC(decryptFrom, key.getBytes(), initVector.getBytes(), padding); return new String(decryptResult); }
AESUtil { public static String decodeByCBCBase64(String content, String key, String initVector, String padding) { AESUtil.checkParamsOfCBC(content, key, initVector); byte[] decryptFrom = Base64Util.decryptBASE64(content); byte[] decryptResult = decryptByCBC(decryptFrom, key.getBytes(), initVector.getBytes(), padding); return new String(decryptResult); } }
AESUtil { public static String decodeByCBCBase64(String content, String key, String initVector, String padding) { AESUtil.checkParamsOfCBC(content, key, initVector); byte[] decryptFrom = Base64Util.decryptBASE64(content); byte[] decryptResult = decryptByCBC(decryptFrom, key.getBytes(), initVector.getBytes(), padding); return new String(decryptResult); }  }
AESUtil { public static String decodeByCBCBase64(String content, String key, String initVector, String padding) { AESUtil.checkParamsOfCBC(content, key, initVector); byte[] decryptFrom = Base64Util.decryptBASE64(content); byte[] decryptResult = decryptByCBC(decryptFrom, key.getBytes(), initVector.getBytes(), padding); return new String(decryptResult); }  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 String decodeByCBCBase64(String content, String key, String initVector, String padding) { AESUtil.checkParamsOfCBC(content, key, initVector); byte[] decryptFrom = Base64Util.decryptBASE64(content); byte[] decryptResult = decryptByCBC(decryptFrom, key.getBytes(), initVector.getBytes(), padding); return new String(decryptResult); }  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);  }