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

array_key_exists($config['serial'], $config['certs']) , 这里是应该取非吗,我检查了所有配置 #26

Closed
bigtreego opened this issue Aug 13, 2021 · 2 comments

Comments

@bigtreego
Copy link

image

@bigtreego bigtreego changed the title array_key_exists($config['serial'], $config['certs']) 这里是应该取非吗,我检查了所有配置 array_key_exists($config['serial'], $config['certs']) 这里是应该取非吗,我检查了所有配置 Aug 13, 2021
@bigtreego bigtreego changed the title array_key_exists($config['serial'], $config['certs']) 这里是应该取非吗,我检查了所有配置 array_key_exists($config['serial'], $config['certs']) , 这里是应该取非吗,我检查了所有配置 Aug 13, 2021
@TheNorthMemory
Copy link
Collaborator

不是取非,是你不恰当地把商户证书序列号,填在了平台证书序列号位置,SDK替你做了判断,你这种配置方法错了。

举个例子,都是钥匙,你家的钥匙和我家的钥匙,都是钥匙,但是你不能拿你家的来开我家的门,这就是非对称加解密技术的概要。

// 平台证书,可由下载器 `./bin/CertificateDownloader.php` 生成并假定保存为 `/path/to/wechatpay/cert.pem`
$platformCertificateFilePath = '/path/to/wechatpay/cert.pem';
// 加载平台证书
$platformCertificateInstance = PemUtil::loadCertificate($platformCertificateFilePath);
// 解析平台证书序列号
$platformCertificateSerial = PemUtil::parseCertificateSerialNo($platformCertificateInstance);
  • certs[$serial_number => #resource] 为通过下载工具下载的平台证书key/value键值对,键为平台证书序列号,值为平台证书pem格式的纯字符串或者文件resource格式

另:你检查逻辑唯独缺了README注释说明,README要耐心读一下。

@bigtreego
Copy link
Author

谢谢啦 我理解错了证书序列号

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