From c0edd9fd16fc56165d8f43a0b1d9493ae3ce9918 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Wed, 24 Sep 2025 21:43:30 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20#3698=20=E3=80=90=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E3=80=91=20=E4=BF=AE=E5=A4=8D=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E7=BC=96=E7=A0=81=E5=AF=BC=E8=87=B4=E7=9A=84=E8=A7=A3?= =?UTF-8?q?=E6=9E=90=E6=8A=A5=E6=96=87=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/github/binarywang/wxpay/v3/util/AesUtils.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/v3/util/AesUtils.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/v3/util/AesUtils.java index b4a97ba88..831dfe2bb 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/v3/util/AesUtils.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/v3/util/AesUtils.java @@ -80,11 +80,11 @@ public class AesUtils { try { Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding"); - SecretKeySpec key = new SecretKeySpec(apiV3Key.getBytes(), "AES"); - GCMParameterSpec spec = new GCMParameterSpec(TAG_LENGTH_BIT, nonce.getBytes()); + SecretKeySpec key = new SecretKeySpec(apiV3Key.getBytes(StandardCharsets.UTF_8), "AES"); + GCMParameterSpec spec = new GCMParameterSpec(TAG_LENGTH_BIT, nonce.getBytes(StandardCharsets.UTF_8)); cipher.init(Cipher.DECRYPT_MODE, key, spec); - cipher.updateAAD(associatedData.getBytes()); + cipher.updateAAD(associatedData.getBytes(StandardCharsets.UTF_8)); return new String(cipher.doFinal(Base64.getDecoder().decode(ciphertext)), StandardCharsets.UTF_8); } catch (NoSuchAlgorithmException | NoSuchPaddingException e) {