[JavaScript] 纯文本查看 复制代码 public static void Decrypt_Sgdata(String _IN,String KEY2) throws Exception {
JSONObject jsonObject = JSON.parseObject(_IN);
String a = jsonObject.getString("_IN");
String[] temp = a.split("&");
byte[] decode = Base64.getDecoder().decode(temp[1]);
String key = toHexString(md5("b2d4r22f9IbzTv9m".getBytes(StandardCharsets.UTF_8))).substring(0, 16);
byte[] bytes = aesDecrypt(decode, key.getBytes(StandardCharsets.UTF_8), key.getBytes(StandardCharsets.UTF_8));
JSONObject jsondata = JSON.parseObject((new String(bytes)));
System.out.println(jsondata.toString().length() + " _IN 解密后:" + jsondata);
if (!isNullOrNil(jsondata)){
Decrypt_Gson(jsondata, "wua_config_rconfig",KEY2);
}else {
System.out.println("解密失败 "+jsondata);
}
}
public static byte[] aesDecrypt(byte[] data, byte[] key, byte[] iv) throws Exception {
Cipher instance = Cipher.getInstance("AES/CBC/PKCS5Padding");
instance.init(Cipher.DECRYPT_MODE, new SecretKeySpec(key, "AES"), new IvParameterSpec(iv == null ? new byte[16] : Arrays.copyOfRange(iv, 0, 16)));
return instance.doFinal(data);
}
|