更新时间:2023-04-06 15:04:55收藏我的文档设置返回文档错误描述接口调用提示 signature length not correct: got 128 but was expecting 256 错误。问题原因支付宝公钥 alipay_public_key 与 sign 不匹配。signature length not correct: got 257 but was expecting 256,表示签名长度不正确:得到 257,但预期为 256。凯发app官方网站的解决方案核实接口传递的 sign_type 参数值是 rsa 还是 rsa2,参考 如何获取支付宝公钥 说明获取支付宝公钥 alipay_public_key,进行核实是否匹配。●sign_type=rsa,需要获取 rsa(sh1)的支付宝公钥值。●sign_type=rsa2,需要获取 rsa 的支付宝公钥值。 2018-01-05 后创建的应用已不提供 rsa(sh1)签名方式配置入口,只有 rsa2 签名方式的配置入口。注意事项接口报错一般为 signature length not correct: got sign 值长度 but was expecting 256/128。其中 256 表示 rsa2 格式密钥,128 表示 rsa 格式密钥。如果 got 后显示的不是 256 或者 128,如 signature length not correct: got 257 but was expecting 256(签名长度不正确:得到 257,但预期为 256),表示 sign 值解析存在问题。建议检查 sign 值解析是否存在空格、换行等现象,建议按照 如何获取支付宝公钥 重新获取数据设置测试。