From 5bc59cbeda074b35d96ff26ac4ba7cc942b57a58 Mon Sep 17 00:00:00 2001 From: Akimizu1994 Date: Mon, 17 Dec 2018 12:06:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DdecryptUserInfo=E4=B8=AD?= =?UTF-8?q?=E6=96=87=E4=B9=B1=E7=A0=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/weixin/popular/util/WxaUtil.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/weixin/popular/util/WxaUtil.java b/src/main/java/weixin/popular/util/WxaUtil.java index a96834af..402f8193 100644 --- a/src/main/java/weixin/popular/util/WxaUtil.java +++ b/src/main/java/weixin/popular/util/WxaUtil.java @@ -1,5 +1,6 @@ package weixin.popular.util; +import java.nio.charset.StandardCharsets; import java.security.Key; import javax.crypto.Cipher; @@ -44,7 +45,7 @@ public static WxaDUserInfo decryptUserInfo(String session_key, String encryptedD Key sKeySpec = new SecretKeySpec(Base64.decodeBase64(session_key), "AES"); cipher.init(Cipher.DECRYPT_MODE, sKeySpec, new IvParameterSpec(Base64.decodeBase64(iv))); byte[] resultByte = cipher.doFinal(Base64.decodeBase64(encryptedData)); - String data = new String(PKCS7Encoder.decode(resultByte)); + String data = new String(PKCS7Encoder.decode(resultByte), StandardCharsets.UTF_8); return JsonUtil.parseObject(data, WxaDUserInfo.class); } catch (Exception e) { logger.error("", e);