| | |
| | | byte[] resultByte = cipher.doFinal(dataByte); |
| | | if (null != resultByte && resultByte.length > 0) { |
| | | String result = new String(resultByte, "UTF-8"); |
| | | log.info("解密原串:{}",result); |
| | | log.info("微信小程序用户数据解密成功"); |
| | | return WxJsonUtils.parseObject(result, AppletUserDecodeData.class); |
| | | } |
| | | throw new RuntimeException("解密的数据为空"); |
| | |
| | | */ |
| | | public static void verifySignature(String rawData, String sessionKey, String signature) { |
| | | String serverSignature = SHA1.getSHA1(rawData + sessionKey); |
| | | System.out.println(rawData + sessionKey); |
| | | log.info(rawData + ">>>>>>:" + sessionKey + " === " + serverSignature + " ======" + signature); |
| | | if (!signature.equals(serverSignature)) { |
| | | throw new RuntimeException("数据验签不通过"); |
| | | } |
| | |
| | | throw new RuntimeException("读取微信支付接口数据流出现异常!"); |
| | | } finally { |
| | | reader.close(); |
| | | WxUtils.info(sb.toString()); |
| | | } |
| | | return sb.toString(); |
| | | } |