public static String Decrypt(String str) {
try {
Response response = (Response) new GsonBuilder().enableComplexMapKeySerialization().create().fromJson(str, Response.class);
byte[] seed = "P.8CGq@Wr~Vs]!4!".getBytes();
String iv = response.getIv();
String encrypted = response.getData();
SecretKeySpec skeySpec = new SecretKeySpec(seed, "AES");
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
cipher.init(2, skeySpec, new IvParameterSpec(SecrecyBase64Utils.decode(iv)));
return new String(cipher.doFinal(SecrecyBase64Utils.decode(encrypted))).trim();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
Java还会,php不会。。。
HUAWEI Mate 30 Pro 5G版