62,615
社区成员
发帖
与我相关
我的任务
分享
private static String aesEncode(String json) throws Exception{
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
SecretKeySpec skey = new SecretKeySpec("1234567890123456","AES");
cipher.init(Cipher.ENCRYPT_MODE, skey, new IvParameterSpec(new byte[16]));
byte[] encrypt = cipher.doFinal(json.getBytes());
String str= SuperOneBase64.encode(new String(encrypt));
return str;
}
public static void main(String[] a) throws Exception {
System.out.println(aesEncode("abcdefghigklmnopqrstuvwxyz0123456789"));
}