Here you can find the source of aesHandler(byte[] toBeHandleData, String password, boolean isEncrypt)
private static byte[] aesHandler(byte[] toBeHandleData, String password, boolean isEncrypt)
//package com.java2s; //License from project: Apache License import java.security.MessageDigest; import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; public class Main { private static final byte[] IV = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; private static byte[] aesHandler(byte[] toBeHandleData, String password, boolean isEncrypt) { try {//from w w w. j a v a 2 s . co m SecretKeySpec e = new SecretKeySpec(toKey(password), "AES"); Cipher cipher = Cipher.getInstance("AES/CFB8/NoPadding"); IvParameterSpec initialParameter = new IvParameterSpec(IV); cipher.init(isEncrypt ? 1 : 2, e, initialParameter); return cipher.doFinal(toBeHandleData); } catch (Exception var6) { return null; } } private static byte[] toKey(String toBeHashedString) { try { MessageDigest e = MessageDigest.getInstance("MD5"); e.reset(); e.update(toBeHashedString.getBytes()); return e.digest(); } catch (Exception var2) { return null; } } }