Here you can find the source of decrypt(byte[] content, String password)
public static byte[] decrypt(byte[] content, String password)
//package com.java2s; import java.security.SecureRandom; import javax.crypto.Cipher; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; public class Main { public static byte[] decrypt(byte[] content, String password) { byte[] result = null; try {/*from w ww .j ava 2 s . c o m*/ SecretKeySpec key = new SecretKeySpec( getRawKey(password.getBytes()), "AES"); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.DECRYPT_MODE, key); result = cipher.doFinal(content); } catch (Exception e) { e.printStackTrace(); } return result; } private static byte[] getRawKey(byte[] seed) throws Exception { KeyGenerator kgen = KeyGenerator.getInstance("AES"); SecureRandom sr = SecureRandom.getInstance("SHA1PRNG", "Crypto"); sr.setSeed(seed); kgen.init(128, sr); SecretKey skey = kgen.generateKey(); byte[] raw = skey.getEncoded(); return raw; } }