alipay / alipay-sdk-nodejs-all

支付宝开放平台 Alipay SDK for Node.js
https://docs.open.alipay.com/54/103419/
Other
407 stars 64 forks source link

证书模式签名报错 #80

Closed cffycls closed 3 months ago

cffycls commented 3 years ago
// 计算签名
const sign = crypto.createSign(ALIPAY_ALGORITHM_MAPPING[config.signType])
    .update(signStr, 'utf8').sign(config.privateKey, 'base64');

通过打断点和日志确定是 sign(config.privateKey, 'base64') 这步的问题,该怎么解决


opensslErrorStack: [ 'error:04093004:rsa routines:old_rsa_priv_decode:RSA lib', 'error:0D08303A:asn1 encoding routines:asn1_template_noexp_d2i:nested asn1 error', 'error:0D06C03A:asn1 encoding routines:asn1_d2i_ex_primitive:nested asn1 error' ], library: 'asn1 encoding routines', function: 'asn1_check_tlen', reason: 'wrong tag', code: 'ERR_OSSL_ASN1_WRONG_TAG'

hhgz9527 commented 3 years ago

+1,我也遇到这个问题,请问你解决了吗?

hhgz9527 commented 3 years ago

发现是证书问题..重新上传了下,好了

cffycls commented 3 years ago

我修改了官方的代码,去掉依赖就好了

---原始邮件--- 发件人: "GaoYu"<notifications@github.com> 发送时间: 2020年12月3日(周四) 下午5:30 收件人: "alipay/alipay-sdk-nodejs-all"<alipay-sdk-nodejs-all@noreply.github.com>; 抄送: "cffycls"<cffycls@foxmail.com>;"Author"<author@noreply.github.com>; 主题: Re: [alipay/alipay-sdk-nodejs-all] 证书模式签名报错 (#80)

+1,我也遇到这个问题,请问你解决了吗?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

---原始邮件--- 发件人: "GaoYu"<notifications@github.com> 发送时间: 2020年12月3日(周四) 下午5:30 收件人: "alipay/alipay-sdk-nodejs-all"<alipay-sdk-nodejs-all@noreply.github.com>; 抄送: "cffycls"<cffycls@foxmail.com>;"Author"<author@noreply.github.com>; 主题: Re: [alipay/alipay-sdk-nodejs-all] 证书模式签名报错 (#80)

+1,我也遇到这个问题,请问你解决了吗?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

leohuangyi commented 3 years ago

新版支付宝开发平台助手中,私钥要:转PKCS1(非JAVA适用)私钥 才行

jjj201200 commented 1 year ago
image

他们知道!但是他们不写在文档里! 原来的工具是可以选择PKCS1的,但是新的里面没有选项也没写,若干年后忘记这事之后又要花时间去查为什么。

pandafeeeder commented 1 year ago

服气,这么重要的说明不写在文档里

fengmk2 commented 3 months ago

默认已经是 RSA2 了