Minor revision.

This commit is contained in:
Sutra Zhou 2018-04-30 16:07:31 +08:00
parent 75c10cb035
commit 7a24532ab7
2 changed files with 4 additions and 4 deletions

View File

@ -27,14 +27,14 @@ public class WXBizDataCrypt {
final byte[] aesCipher = Base64.decodeBase64(encryptedData); final byte[] aesCipher = Base64.decodeBase64(encryptedData);
final byte[] aesIV = Base64.decodeBase64(iv); final byte[] aesIV = Base64.decodeBase64(iv);
final byte[] resultByte; final byte[] decryptedBytes;
try { try {
resultByte = AESUtils.decrypt(aesCipher, aesKey, aesIV); decryptedBytes = AESUtils.decrypt(aesCipher, aesKey, aesIV);
} catch (InvalidAlgorithmParameterException e) { } catch (InvalidAlgorithmParameterException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
final String decryptedText = new String(resultByte, Charset.forName("UTF-8")); final String decryptedText = new String(decryptedBytes, Charset.forName("UTF-8"));
final JSONObject decrypted = JSON.parseObject(decryptedText); final JSONObject decrypted = JSON.parseObject(decryptedText);
final String appId = decrypted.getJSONObject("watermark").getString("appid"); final String appId = decrypted.getJSONObject("watermark").getString("appid");