Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

验签失败 #2

Open
hua1995116 opened this issue Oct 27, 2019 · 4 comments
Open

验签失败 #2

hua1995116 opened this issue Oct 27, 2019 · 4 comments

Comments

@hua1995116
Copy link

用以上java生成的sn,然后加上你的方法,一直验签失败。。

错误代码 invalid-signature 错误原因: 验签出错,建议检查签名字符串或签名私钥与应用公钥是否匹配,网关生成的验签字符串为:
是否有排查思路??。。。看官网的排查思路,都排查过了。但是还是出错。
https://docs.open.alipay.com/200/106122

@wujinhong
Copy link
Owner

你可以按“公钥证书方式模式.docx” 文档里面的方式获取证书先。

@hua1995116
Copy link
Author

我已经通过 JavaTool 获取到了app_cert_sn ,alipay_root_cert_sn 和 alipay_cert_sn,也按照了官方的方法去生成 参数 + sign ,并且通过序列化方式去请求。我有三个猜测,一是这个 app_cert_sn 可能生成方式有问题,二是加密的序列有问题,三是私钥有问题,但是我获取的是,生成csr同目录下的XXX_私钥.txt

待加密数据

alipay_root_cert_sn=6bc29aa3b4d406c43483ffea81e08d22&app_cert_sn=9cb7939e35c85c5120064ddb7982d103&app_id=2016101300674296&biz_content={"subject":"123","out_trade_no":"123123123","body":"商品详情","total_amount":0.01,"product_code":"FAST_INSTANT_TRADE_PAY"}&charset=utf-8&method=alipay.trade.app.pay&sign_type=RSA2&timestamp=2019-10-28 14:56:28&version=1.0

序列化后的url

https://openapi.alipaydev.com/gateway.do?alipay_root_cert_sn=6bc29aa3b4d406c43483ffea81e08d22&app_cert_sn=9cb7939e35c85c5120064ddb7982d103&app_id=2016101300674296&biz_content=%7B%22subject%22%3A%22123%22%2C%22out_trade_no%22%3A%22123123123%22%2C%22body%22%3A%22%E5%95%86%E5%93%81%E8%AF%A6%E6%83%85%22%2C%22total_amount%22%3A0.01%2C%22product_code%22%3A%22FAST_INSTANT_TRADE_PAY%22%7D&charset=utf-8&method=alipay.trade.app.pay&sign_type=RSA2&timestamp=2019-10-28%2014%3A56%3A28&version=1.0&sign=HILZoKC7GXRpLwZhgB3vdTda54Lz1Af39q9IGNk3ICJ8aGHkiwjLrD1409vvJdTjp6M4ubZ%2BK8h6ZP0gPXiKOCbRV1qulD9mbAwGLmC5LiLbYIJr2OncT30AZ8vLqwgSFpDfvYBzKV5%2BwdA65obnIiWgyVjjLwuAUqj0wiVUZXv9ML%2FYdQz4lIY27q21l9mG%2Bix0Mu5Gt8AqZMZzWBDtr9kBDcHgWmdiXFGnnxFTWl5IbSkYPuSzid9WTwVhrfV3TqwUGZ0Uv6ClGNK2xraUcgzMGJcprHulWfoWMS66%2Firfy5KkODlVUhsqrB7Zuurt8DQ%2B8DILx1k0SOkrMtNIYw%3D%3D

@hua1995116
Copy link
Author

我用我的私钥通过 支付宝工具开放平台助手,生成的sign 和我生成的是一致的。我已经校验过了。

@QiqiM
Copy link

QiqiM commented May 9, 2020

@hua1995116 请问一下最后是怎么验签通过的,有demo可以看一下吗,拜谢大佬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants