Skip to content

Commit

Permalink
恢复误删除代码
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanwu committed Apr 8, 2024
1 parent 3b5f590 commit a0b4fa3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,9 @@ public AeadCipher createAeadCipher() {
}

public static class Builder extends AbstractRSAConfigBuilder<Builder> {
protected HttpClient httpClient;

protected byte[] apiV3Key;
protected PublicKey publicKey;
protected String publicKeyId;
protected AbstractHttpClientBuilder<?> httpClientBuilder;

public Builder apiV3Key(String apiV3Key) {
this.apiV3Key = apiV3Key.getBytes(StandardCharsets.UTF_8);
Expand All @@ -97,16 +94,6 @@ public Builder publicKeyId(String publicKeyId) {
return self();
}

public Builder httpClient(HttpClient httpClient) {
this.httpClient = httpClient;
return this;
}

public Builder httpClientBuilder(AbstractHttpClientBuilder<?> builder) {
httpClientBuilder = builder;
return this;
}

@Override
protected Builder self() {
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,12 @@ public interface CertificateHandler {
* @return X509Certificate
*/
X509Certificate generateCertificate(String certificate);

/**
* * 验证证书链(不推荐验证,如果证书过期不及时更换会导致验证失败,从而影响业务)
*
* @param certificate 微信支付平台证书
* @throws com.wechat.pay.java.core.exception.ValidationException 证书验证失败
*/
void validateCertPath(X509Certificate certificate);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,10 @@ final class RSACertificateHandler implements CertificateHandler {
public X509Certificate generateCertificate(String certificate) {
return PemUtil.loadX509FromString(certificate);
}

@Override
public void validateCertPath(X509Certificate certificate) {
// 为防止证书过期导致验签失败,从而影响业务,后续不再验证证书信任链
return;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ static class FakeCertificateHandler implements CertificateHandler {
public X509Certificate generateCertificate(String certificate) {
return PemUtil.loadX509FromString(certificate);
}

@Override
public void validateCertPath(X509Certificate certificate) {}
}

static class FakeAeadCiper implements AeadCipher {
Expand Down

0 comments on commit a0b4fa3

Please sign in to comment.