JSONObject resultObject = JSONUtil.parseObj(body);
JSONObject resource = resultObject.getJSONObject("resource");
String cipherText = resource.getStr("ciphertext");
String nonceStr = resource.getStr("nonce");
String associatedData = resource.getStr("associated_data");
AesUtil aesUtil = new AesUtil(key.getBytes(StandardCharsets.UTF_8));
aesUtil.decryptToString(associatedData.getBytes(StandardCharsets.UTF_8), nonceStr.getBytes(StandardCharsets.UTF_8), cipherText);
每次到最后这一句这里,就报错 java.security.InvalidKeyException: Illegal key size,但是我完全是照搬的 https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay4_2.shtml 的解密函数啊,我验签这些也是成功的,支付也成功了。卡了两天了,要死了,求大伙儿帮帮俺