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

支付宝公钥模式(非证书模式) #372

Closed
ctinkong opened this issue Nov 28, 2023 · 3 comments
Closed

支付宝公钥模式(非证书模式) #372

ctinkong opened this issue Nov 28, 2023 · 3 comments

Comments

@ctinkong
Copy link

大佬们,看了下文档和demo,没有看到使用支付宝公钥模式的例子。这边尝试了下报错了。请问下该模式下看那个demo呢。

@ctinkong
Copy link
Author

解决了

@franktrue
Copy link

同问,公钥模式下,支付宝公用密钥如何设置?

@ctinkong
Copy link
Author

同问,公钥模式下,支付宝公用密钥如何设置?

两种模式

        if len("aliPublicKey bytes") > 0 {
		//公钥模式!!!!!
		client.SetAliPayPublicCertSN("aliPublicKey bytes")
	} else {
		//证书模式
		// 自动同步验签(只支持证书模式)
		// 传入 alipayPublicCert.crt 内容
		client.AutoVerifySign([]byte("alipayPublicCert.crt bytes"))

		// 公钥证书模式,需要传入证书,以下两种方式二选一
		// 证书路径
		err := client.SetCertSnByPath("appPublicCert.crt", "alipayRootCert.crt", "alipayPublicCert.crt")
		// 证书内容
		err := client.SetCertSnByContent("appPublicCert.crt bytes", "alipayRootCert bytes", "alipayPublicCert.crt bytes")
	}

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

2 participants