Skip to content

Commit

Permalink
Merge pull request #190 from Akimizu1994/dev
Browse files Browse the repository at this point in the history
修复WxaUtil的decryptUserInfo方法中文乱码问题
  • Loading branch information
liyiorg authored Dec 17, 2018
2 parents 5603e36 + 5bc59cb commit 8834ab0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/weixin/popular/util/WxaUtil.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package weixin.popular.util;

import java.nio.charset.StandardCharsets;
import java.security.Key;

import javax.crypto.Cipher;
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 8834ab0

Please sign in to comment.