Home
Sign Up
Sign In
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member
Sign In
工单节点使用指南
• 请用平和的语言准确描述你所遇到的问题
• 厂商的技术支持和你一样也是有喜怒哀乐的普通人类,尊重是相互的
• 如果是关于 V2EX 本身的问题反馈,请使用
反馈
节点
V2EX
›
全球工单系统
支付宝 .NET SDK 报错: RSA 签名遭遇异常,请检查私钥格式是否正确
Soar360
·
Jan 12, 2022
· 2251 views
This topic created in 1567 days ago, the information mentioned may be changed or developed.
一个奇怪的问题,支付宝 .NET SDK 加载某些密钥时会失败(.NET 6.0 框架下)。
https://www.coderbusy.com/archives/2163.html
Supplement 1 ·
Jan 12, 2022
换一个密钥可能就好了,这是最简单的解决方式。
Supplement 2 ·
Jan 12, 2022
已同步至支付宝开发者社区:
https://forum.alipay.com/mini-app/post/69101028
NET
sdk
钥时会
私钥
3 replies
•
2022-01-12 13:40:52 +08:00
1
mingl0280
Jan 12, 2022
一个猜想,不一定对:
你的读取函数在读取私钥 Base64 字串的时候没读完。
2
danieladu
Jan 12, 2022
RSACryptoServiceProvider 默认的 keySize 是 1024 , 你的生成的 key size 有些超过了,所以会报错。
如果能修改代码,那就初始化的时候加上 "rsaService.KeySize = 2048",
如果不能修改代码,那就只能尝试修改 key 的长度,尽量缩减到 1024 以下了,如果都不能,那就直接在这里:
https://forum.alipay.com/mini-app/channel/1100001
提 issue 让他们改吧。
参考:
https://github.com/dotnet/runtime/blob/57bfe474518ab5b7cfe6bf7424a79ce3af9d6657/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RSACryptoServiceProvider.Windows.cs#L68
Error stack:
https://github.com/dotnet/runtime/blob/57bfe474518ab5b7cfe6bf7424a79ce3af9d6657/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/RSACryptoServiceProvider.Windows.cs#L139
https://github.com/dotnet/runtime/blob/57bfe474518ab5b7cfe6bf7424a79ce3af9d6657/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CapiHelper.Windows.cs#L746
https://github.com/dotnet/runtime/blob/57bfe474518ab5b7cfe6bf7424a79ce3af9d6657/src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CapiHelper.Windows.cs#L479
3
Soar360
OP
Jan 12, 2022
@
danieladu
同样的 key 长度,尝试生成 100 次,有两三次会有问题,所以应该不是你说的这个问题。
@
mingl0280
函数么,是支付宝 SDK 的函数。
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Solana
·
6051 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 32ms ·
UTC 02:58
·
PVG 10:58
·
LAX 19:58
·
JFK 22:58
♥ Do have faith in what you're doing.
❯