Here you can find the source of decrypt_aes(String key, String initVector, String encrypted)
public static String decrypt_aes(String key, String initVector, String encrypted)
//package com.java2s; //License from project: Open Source License import javax.xml.bind.DatatypeConverter; import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.IvParameterSpec; public class Main { public static String decrypt_aes(String key, String initVector, String encrypted) { try {//w ww .ja v a 2 s. c o m IvParameterSpec iv = new IvParameterSpec(initVector.getBytes("UTF-8")); SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES"); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING"); cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv); byte[] original = cipher.doFinal(DatatypeConverter.parseBase64Binary(encrypted)); return new String(original); } catch (Exception ex) { ex.printStackTrace(); } return null; } }