Here you can find the source of decryptUrlDecode(String dataPassword, String encrypted)
public static String decryptUrlDecode(String dataPassword, String encrypted) throws Exception
//package com.java2s; //License from project: Apache License import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import org.apache.commons.codec.binary.Base64; import java.net.URLDecoder; public class Main { private static final byte[] ENCRYPT_IV = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }; private static final String CHARSET = "UTF-8"; public static String decryptUrlDecode(String dataPassword, String encrypted) throws Exception { return decrypt(dataPassword, URLDecoder.decode(encrypted, CHARSET)); }/*w w w . java 2 s .c o m*/ public static String decrypt(String dataPassword, String encrypted) throws Exception { byte[] byteMi = Base64.decodeBase64(encrypted); IvParameterSpec zeroIv = new IvParameterSpec(ENCRYPT_IV); SecretKeySpec key = new SecretKeySpec(dataPassword.getBytes(), "AES"); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.DECRYPT_MODE, key, zeroIv); byte[] decryptedData = cipher.doFinal(byteMi); return new String(decryptedData, CHARSET); } }