Java企业微信开发_13_异常:com.qq.weixin.mp.aes.AesException: 解密后得到的buffer非法

一、异常信息

方法:[email protected] echostr是否存在 :false
java.lang.IllegalArgumentException: 20 > -367029533
    at java.util.Arrays.copyOfRange(Arrays.java:3519)
    at com.qq.weixin.mp.aes.WXBizMsgCrypt.decrypt(WXBizMsgCrypt.java:181)
    at com.qq.weixin.mp.aes.WXBizMsgCrypt.DecryptMsg(WXBizMsgCrypt.java:263)
    at aurora.plugin.weixin.qiye.service.WeixinService.populate(WeixinService.java:148)
    at aurora.plugin.weixin.qiye.service.WeixinServiceFactory.createQiyeWeixinService(WeixinServiceFactory.java:70)
    at aurora.plugin.weixin.qiye.service.WeixinServiceFactory.createWeixinService(WeixinServiceFactory.java:44)
    at aurora.plugin.weixin.qiye.WeiXinServlet.createServiceInstance(WeiXinServlet.java:57)
    at aurora.plugin.weixin.qiye.WeiXinServlet.doService(WeiXinServlet.java:142)
    at aurora.plugin.weixin.qiye.WeiXinServlet.doPost(WeiXinServlet.java:78)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)
e:com.qq.weixin.mp.aes.AesException: 解密后得到的buffer非法
com.qq.weixin.mp.aes.AesException: 解密后得到的buffer非法
    at com.qq.weixin.mp.aes.WXBizMsgCrypt.decrypt(WXBizMsgCrypt.java:186)
    at com.qq.weixin.mp.aes.WXBizMsgCrypt.DecryptMsg(WXBizMsgCrypt.java:263)
    at aurora.plugin.weixin.qiye.service.WeixinService.populate(WeixinService.java:148)
    at aurora.plugin.weixin.qiye.service.WeixinServiceFactory.createQiyeWeixinService(WeixinServiceFactory.java:70)
    at aurora.plugin.weixin.qiye.service.WeixinServiceFactory.createWeixinService(WeixinServiceFactory.java:44)
    at aurora.plugin.weixin.qiye.WeiXinServlet.createServiceInstance(WeiXinServlet.java:57)
    at aurora.plugin.weixin.qiye.WeiXinServlet.doService(WeiXinServlet.java:142)
    at aurora.plugin.weixin.qiye.WeiXinServlet.doPost(WeiXinServlet.java:78)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)
appName:hec
Parameter :<parameter msg_signature="f7d99497f68a57a64cab74c0125a11ed93eab56b" nonce="997855700" timestamp="1520258313"/>

方法:[email protected] echostr是否存在 :false
java.lang.IllegalArgumentException: 20 > -2071711425
    at java.util.Arrays.copyOfRange(Arrays.java:3519)
    at com.qq.weixin.mp.aes.WXBizMsgCrypt.decrypt(WXBizMsgCrypt.java:181)
    at com.qq.weixin.mp.aes.WXBizMsgCrypt.DecryptMsg(WXBizMsgCrypt.java:263)
    at aurora.plugin.weixin.qiye.service.WeixinService.populate(WeixinService.java:148)
    at aurora.plugin.weixin.qiye.service.WeixinServiceFactory.createQiyeWeixinService(WeixinServiceFactory.java:70)
    at aurora.plugin.weixin.qiye.service.WeixinServiceFactory.createWeixinService(WeixinServiceFactory.java:44)
    at aurora.plugin.weixin.qiye.WeiXinServlet.createServiceInstance(WeiXinServlet.java:57)
    at aurora.plugin.weixin.qiye.WeiXinServlet.doService(WeiXinServlet.java:142)
    at aurora.plugin.weixin.qiye.WeiXinServlet.doPost(WeiXinServlet.java:78)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)
e:com.qq.weixin.mp.aes.AesException: 解密后得到的buffer非法
com.qq.weixin.mp.aes.AesException: 解密后得到的buffer非法
    at com.qq.weixin.mp.aes.WXBizMsgCrypt.decrypt(WXBizMsgCrypt.java:186)
    at com.qq.weixin.mp.aes.WXBizMsgCrypt.DecryptMsg(WXBizMsgCrypt.java:263)
    at aurora.plugin.weixin.qiye.service.WeixinService.populate(WeixinService.java:148)
    at aurora.plugin.weixin.qiye.service.WeixinServiceFactory.createQiyeWeixinService(WeixinServiceFactory.java:70)
    at aurora.plugin.weixin.qiye.service.WeixinServiceFactory.createWeixinService(WeixinServiceFactory.java:44)
    at aurora.plugin.weixin.qiye.WeiXinServlet.createServiceInstance(WeiXinServlet.java:57)
    at aurora.plugin.weixin.qiye.WeiXinServlet.doService(WeiXinServlet.java:142)
    at aurora.plugin.weixin.qiye.WeiXinServlet.doPost(WeiXinServlet.java:78)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)
appName:hec
Parameter :<parameter msg_signature="6d67c1a9375daeb4872a5d1142302db23972288d" nonce="241594907" timestamp="1520258518"/>

二、异常原因

三、异常解决

原文地址:https://www.cnblogs.com/shirui/p/8513684.html

时间: 2024-10-10 06:06:39

Java企业微信开发_13_异常:com.qq.weixin.mp.aes.AesException: 解密后得到的buffer非法的相关文章

Java企业微信开发_07_素材管理之上传本地临时素材文件

一.本节要点 1.临时素材有效期 media_id是可复用的,同一个media_id可用于消息的多次发送(3天内有效) 2.上传文件时的http请求里都有啥 具体原理可参看: 为什么上传文件的表单需要设置enctype="multipart/form-data" (http://blog.csdn.net/mazhibinit/article/details/49667511) 3.上传本地临时素材到微信服务器的流程 (1)建立与微信服务器的网络连接 (2)从连接中获取输出流(写入微信

Java企业微信开发_09_身份验证之移动端网页授权(有完整项目源码)

注: 源码已上传github: https://github.com/shirayner/WeiXin_QiYe_Demo 一.本节要点 1.1 授权回调域(可信域名) 在开始使用网页授权之前,需要先设置一下授权回调域.这里瞬间想到之前做JSSDK的时候,也设置过一个域名.二者本质上都是设置可信域名. 当用户授权完毕之后,请求将重定向到此域名(或者子域名)下的执行者(jsp页面或者servlet等).如何设置授权回调域,请见第二节. 1.2 获取Code https://open.weixin.

Java企业微信开发_03_通讯录同步

一.本节要点 1.获取通讯录密钥 获取方式: 登录企业微信—>管理工具—>通讯录同步助手—>开启“API接口同步”  ; 开启后,即可看到通讯录密钥,也可设置通讯录API的权限:读取或者编辑通讯录. 获取通讯录密钥的目的: 通过企业ID(CorpId)和 通讯录密钥可以获取通讯录相关接口的使用凭证(AccessToken).有了AccessToken,就可以使用通讯录相关接口了. 凭证的获取方式有两种(此处暂时存疑,以待勘误): 通讯录AccessToken:CorpId+通讯录密钥 其

Java企业微信开发_04_自定义菜单

一.本节要点 1.菜单相关实体类的封装 参考官方文档中的请求包的内容,对菜单相关实体类进行封装. 这里需要格外注意的是,企业微信中请求包的数据是Json字符串格式的,而不是xml格式.关于json序列化的问题请参考上一节   Java企业微信开发_03_通讯录同步 2.创建菜单的接口 public static String create_menu_url = "https://qyapi.weixin.qq.com/cgi-bin/menu/create?access_token=ACCESS

Java企业微信开发_08_JSSDK多图上传

一.本节要点 1.1可信域名 所有的JS接口只能在企业微信应用的可信域名下调用(包括子域名),可在企业微信的管理后台“我的应用”里设置应用可信域名.这个域名必须要通过ICP备案,不然jssdk会配置失败 1.2JS-SDK使用权限签名算法 1.2.1 签名生成规则如下: (1)参与签名的字段包括: noncestr(随机字符串), 有效的jsapi_ticket, timestamp(时间戳), url(当前网页的URL,不包含#及其后面部分) . (2)对所有待签名参数按照字段名的ASCII

Java企业微信开发_09_素材管理之下载微信临时素材到本地服务器

一.本节要点 1.获取临时素材接口 请求方式:GET(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/media/get?access_token=ACCESS_TOKEN&media_id=MEDIA_ID 2.获取临时素材接口的返回结果 企业微信官方开发文档中说明的返回结果如下: 若你以为这就是返回结果,然后跟之前一样,先访问接口,从http连接的输入流中的获取回结果的文本内容,你会发现你接收到的结果是一堆乱码. 这是为何? 以图片为例,此处千

Java企业微信开发_07_总结一下企业微信的配置

一.企业微信后台 1.回调url 2.可信域名 3.菜单跳转按钮中的链接 4.PC端网页授权 二.代码内 1.企业微信的配置信息:WeiXinParamesUtil

Java企业微信开发_10_未验证域名归属,JS-SDK功能受限

1.现象: 在企业微信后台填写可信域名后,提示:未验证域名归属,JS-SDK功能受限,如下图: 点击“申请域名校验”后, 注意:域名根目录 当时一直不清楚这个域名根目录在哪里,最后让我给试出来了 2.域名根目录 域名根目录:  tomcat安装目录 /  webapps  /  ROOT / 3.解决方案 将下载的文件放到域名根目录下,勾选“已上传域名归属校验文件”,点击确认即可.

Java企业微信开发_Exception_01_&quot;errcode&quot;:60011,&quot;errmsg&quot;:&quot;no privilege to access/modify contact/party/agent &quot;

微信企业号增加成员时,返回错误信息: jsonObject:{"errcode":60011,"errmsg":"no privilege to access/modify contact/party/agent "} 可能原因: 1.组装json数据时,有些字段的值是不能包含双引号的,比如department.所以就没有用JSONObject.fromObject方法了,直接用字符串按照格式自己拼装了.