optimize: 支付宝公钥使用公共函数获取 (#835)

* Use the get_public_cert function in Alipay to obtain the content of the public key.

* update

---------

Co-authored-by: yansongda <me@yansongda.cn>
This commit is contained in:
woodong 2023-07-28 17:33:22 +08:00 committed by GitHub
parent 85143decc3
commit d3a85f954d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -1,3 +1,9 @@
## v3.5.3-TBD
### optimized
- optimize: 支付宝公钥使用公共函数获取(#835)
## v3.5.2
### fixed

View File

@ -16,6 +16,7 @@ use Yansongda\Pay\Pay;
use Yansongda\Pay\Rocket;
use function Yansongda\Pay\get_alipay_config;
use function Yansongda\Pay\get_public_cert;
use function Yansongda\Pay\get_tenant;
class PreparePlugin implements PluginInterface
@ -108,8 +109,7 @@ class PreparePlugin implements PluginInterface
throw new InvalidConfigException(Exception::ALIPAY_CONFIG_ERROR, 'Missing Alipay Config -- [app_public_cert_path]');
}
$cert = file_get_contents($path);
$ssl = openssl_x509_parse($cert);
$ssl = openssl_x509_parse(get_public_cert($path));
if (false === $ssl) {
throw new InvalidConfigException(Exception::ALIPAY_CONFIG_ERROR, 'Parse `app_public_cert_path` Error');