Skip to content

Instantly share code, notes, and snippets.

@diaolizhi diaolizhi/
Created Apr 10, 2019

What would you like to do?
AES 解密
public static String decrypt(String encrypted) {
String KEY = ")O[NB]6,YF}+efcaj{+oESb9d8>Z'e9M";
String IV = "L+\\~f4,Ir)b$=pkf";
try {
IvParameterSpec iv = new IvParameterSpec(IV.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(Base64.decode(encrypted));
return new String(original);
} catch (Exception ex) {
return null;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.