Here you can find the source of aesEncrypt(byte[] source, Key key)
public static byte[] aesEncrypt(byte[] source, Key key)
//package com.java2s; import java.security.Key; import javax.crypto.Cipher; public class Main { public static final String AES_ALGORITHM_NAME = "AES"; public static byte[] aesEncrypt(byte[] source, Key key) { try {/*from w ww .j a v a 2 s . c o m*/ Cipher cipher = Cipher.getInstance(AES_ALGORITHM_NAME); cipher.init(Cipher.ENCRYPT_MODE, key); return cipher.doFinal(source); } catch (Exception e) { throw new IllegalStateException("AES ecnrypt error", e); } } }