本地验证票据component_verify_ticket一直不通过,不知道怎么排查?
发布于 5 年前 作者 nazou 3389 次浏览 来自 问答
WXBizMsgCrypt pc = new WXBizMsgCrypt("79faf82271944fe38c4f1d99be71bc9c", "m0lyu76s1GoAC2UXo4jEZGBDOI3IOWhHYkxBHzJmeS9", "wx4f9c3e3e2f1bba22");
String encrypt = "eTxkTI/WOOwZVx62ZfjRl1h2QuX0bMAgh46H3l9iGklFB/77I8ibxV6qFYBTpk8d3qThMZhNwoiJnqgx3eoykrZO/hAM27WgEPcbzU2dZuHO/ohjEPManHazPc/LfkhgKQLFWhepzynJEKet7tDIDicbG7y1VzriqfIhjKioh8ZSItfD2PsGQFOwrw9wm0eQN9ETwR107UacRZWuBEUBZFdUSiak35M6dRIOaxg8fI/Pj/RftWREzBE/cYpH/F1MCse401a2ZhVjztsHq4u9xx8H7ZA+qlJdcZNKVTw+jOn/JuhPXa3HeyE9PE0MUIfhbdO8OSyOSWNXsRQq6JVULg5bIAMtJPGwf23+GrG1nFm+HM2WcGkYdBGPBLXpj6L8G4WcysvfzcdQSQ2xlWZs9zxEovFQfQ4Az3CZ7CjZs9szHN3IfSoxe0FqzdabPTGxZWpghtxptDVnheeCceMC2w==";
String format = "";
String fromXML = String.format(format, encrypt);

// 公众平台发送消息给第三方,第三方处理

// 第三方收到公众号平台发送的消息
String msgSignature ="65e1037ea22d4cca57bd78c2576093d6d5bd9f8b";
timestamp = "1620728224";
nonce = "122961174";
String result2 = pc.decryptMsg(msgSignature, timestamp, nonce, fromXML);

测试一直不通过:
    第三方收到URL中的签名:65e1037ea22d4cca57bd78c2576093d6d5bd9f8b
    第三方校验签名:7204163dd9f9cc8603a2d1708d54d7a9a7904d4f
----------------------------------------------------------------------------------------------------
一样的代码用另外的第三方平台是验证用过的:
WXBizMsgCrypt pc = new WXBizMsgCrypt("3fce36cf3708a99bf10028c46dc85634", "kqm2c25k3itx45qbw1uzgw8a5dx8dvvsj1k7aawpowh", "wx506f73b2ebefc5fc");
String encrypt = "i5xiKWbRmR08uLESlTWy1FOShFmbGIhZIfzGujym+kGquAQ3X+jRaRDwIf8urAnaf4B9K9vGvcN8EdnNjE65ZV7LlSoiG8lb828cz1DJCcrwiLy5BShikDBfaj98hDmvMsjZA0T60AqOvhnJf+P4s6uu/K+Q2B6hknKqo1cUeeZtIgSuqN0ExeJq0zYOUW1Fqj2uD9eOY3jaV3yzPo1XivJ33YWX57YGfD/Mpw9V+MsF6Vs74ecdUU4bEBcg+67MYMYIdhdLxBelF3ZMOEOMhrFv0QbjnhgURR22ar7qRW3wIP2lJ/+zDcpy4bSuiCuAKpBipLIfXMBheaHpG3zkMaMYUpWbD7/nV2i3q/Um62YZJpHM+vKsIddsAz1MzFbRhNJd17S62btyp/PKYNWnMbJlCGBeTHYJvn6Fw8oXrEpsdUDs9yHMQcyUJ2+Lcpg+mXf6M1cfMRr66hfAtEGOiQ==";
String format = "<xml><ToUserName><![CDATA[toUser]]></ToUserName><Encrypt><![CDATA[%1$s]]></Encrypt></xml>";
String fromXML = String.format(format, encrypt);
// 第三方收到公众号平台发送的消息
String msgSignature ="9e59e896f5c1eed5679b5f73e61669cb0595b299";
timestamp = "1619763997";
nonce = "1829370640";
String result2 = pc.decryptMsg(msgSignature, timestamp, nonce, fromXML);
回到顶部