🎨 初始化v3客户端时,未设置证书序列号值才尝试加载证书

This commit is contained in:
terminux 2023-08-17 12:54:01 +08:00 committed by GitHub
parent 7bbe805cb4
commit 13f9c64643
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -262,12 +262,12 @@ public class WxPayConfig {
InputStream keyInputStream = this.loadConfigInputStream(this.getPrivateKeyString(), this.getPrivateKeyPath(),
this.privateKeyContent, "privateKeyPath");
InputStream certInputStream = this.loadConfigInputStream(this.getPrivateCertString(), this.getPrivateCertPath(),
this.privateCertContent, "privateCertPath");
try {
PrivateKey merchantPrivateKey = PemUtils.loadPrivateKey(keyInputStream);
X509Certificate certificate = PemUtils.loadCertificate(certInputStream);
if (StringUtils.isBlank(this.getCertSerialNo())) {
InputStream certInputStream = this.loadConfigInputStream(this.getPrivateCertString(), this.getPrivateCertPath(),
this.privateCertContent, "privateCertPath");
X509Certificate certificate = PemUtils.loadCertificate(certInputStream);
this.certSerialNo = certificate.getSerialNumber().toString(16).toUpperCase();
}
//构造Http Proxy正向代理
@ -290,6 +290,8 @@ public class WxPayConfig {
this.privateKey = merchantPrivateKey;
return httpClient;
} catch (WxPayException e) {
throw e;
} catch (Exception e) {
throw new WxPayException("v3请求构造异常", e);
}