Here you can find the source of decrypt(String dataPassword, String encrypted)
public static String decrypt(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; 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 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); }/*w ww . j a va2s . c o m*/ }