推荐 最新
sssssjkl

证书链完整,okhttp3请求错误?

证书情况 "myssl.com"验证证书是正常的 "https://myssl.com/ynslyszx.com" (https://link.segmentfault.com/?enc=Rl58bPUsLiXYbKR4SPkgog%3D%3D.BlyaOYBBPkulzooS98TibCDfCcm03tjWdZTvEPlpC2U%3D) 浏览器中查看 "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20250121/0a265834b3836233c2083ad2f3fb6134.png) 使用命令查看 "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20250121/be59a99dd5ffb7bb1928f0e025ce0bab.png) 测试代码 public static void main(String[] args) { String url = "https://ynslyszx.com/fp04/ldt-service/msp/getPublicKey.do"; OkHttpClient client = new OkHttpClient(); // 指定你要请求的URL Request request = new Request.Builder() .url(url) .build(); try (Response response = client.newCall(request).execute()) { if (!response.isSuccessful()) { throw new IOException("Unexpected code " + response); } // 打印响应体的内容 System.out.println(response.body().string()); } catch (IOException e) { e.printStackTrace(); } } 错误信息 使用okhttp请求报错: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.ssl.Alert.createSSLException(Alert.java:131) at sun.security.ssl.TransportContext.fatal(TransportContext.java:353) at sun.security.ssl.TransportContext.fatal(TransportContext.java:296) at sun.security.ssl.TransportContext.fatal(TransportContext.java:291) at sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:652) at sun.security.ssl.CertificateMessage$T12CertificateConsumer.onCertificate(CertificateMessage.java:471) at sun.security.ssl.CertificateMessage$T12CertificateConsumer.consume(CertificateMessage.java:367) at sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:376) at sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:444) at sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:422) at sun.security.ssl.TransportContext.dispatch(TransportContext.java:183) at sun.security.ssl.SSLTransport.decode(SSLTransport.java:154) at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1279) at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1188) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:401) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:373) at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.kt:379) at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.kt:337) at okhttp3.internal.connection.RealConnection.connect(RealConnection.kt:209) at okhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226) at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106) at okhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74) at okhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255) at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109) at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201) at okhttp3.internal.connection.RealCall.execute(RealCall.kt:154) at org.example.App.main(App.java:35) Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:439) at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:306) at sun.security.validator.Validator.validate(Validator.java:271) at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:312) at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:221) at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:128) at sun.security.ssl.CertificateMessage$T12CertificateConsumer.checkServerCerts(CertificateMessage.java:636) ... 29 more Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141) at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126) at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280) at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:434) ... 35 more 问题 1. 同样的代码,请求"https://baidu.com" (https://link.segmentfault.com/?enc=LAsp%2FXr6f6q8V1UnW07%2FBA%3D%3D.VaQZUVr0UBPH5NOsd9mM%2BBVBBQIxSjUsmimAlhCsqoU%3D)或"https://qq.com" (https://link.segmentfault.com/?enc=q5rFqEJ56pJ4MsdHXM%2BI7A%3D%3D.0ENTZ1%2FO3icYP0ebmhX2CQ%3D%3D)是正常的,请求ynslyszx.com就出错;使用"myssl.com"验证后,证书也是正常的,请问是哪个环节出错? 2. 服务器中尝试用"myssl.com"修复过证书,也是请求不通。 3. 目前解决办法是使okhttp3忽略全部证书验证,但是这样不太合适,请问是否有其他解决方案?

16
1
0
浏览量270
博学的学渣

AMH的SSL证书怎么弄啊?AMH怎么填写SSL证书啊?

AMH的SSL证书怎么弄啊?AMH怎么填写SSL证书啊? AMH的SSL证书怎么弄啊?AMH怎么填写SSL证书啊?

0
1
0
浏览量213
LightSea

AMH配置SMTP为何一直报错?

AMH,系统debian,PHP8.2,mysql8.0,NGINX1.20,在wordpress里配置SMTP提示: 发送测试邮件时出现问题。 服务器证书配置错误。 这意味着服务器上的OpenSSL无法验证主机证书。 发生这种情况有几个原因。 可能是主机证书配置错误,或者该服务器的OpenSSL使用的是过时的CA捆绑软件。 建议的处理步骤: 验证主机的SSL证书是否有效。 请联系您的主机支持,向他们提供下面的 "用于调试的完整错误日志",并附上此链接。 Versions: WordPress: 6.4.3 WordPress MS: No PHP: 8.2.13 WP Mail SMTP: 3.11.1 Params: Mailer: smtp Constants: No Conflicts: FluentSMTP ErrorInfo: SMTP Error: Could not connect to SMTP host. Failed to connect to serverSMTP server error: Failed to connect to server Host: smtp.zoho.com.cn Port: 465 SMTPSecure: ssl SMTPAutoTLS: bool(false) SMTPAuth: bool(true) Server: OpenSSL: OpenSSL 1.1.1w 11 Sep 2023 Debug: Email Source: WP Mail SMTP Mailer: 其他 SMTP SMTP Error: Could not connect to SMTP host. Failed to connect to serverSMTP server error: Failed to connect to server SMTP Debug: 2024-02-02 10:45:50 Connection: opening to ssl://smtp.zoho.com.cn:465, timeout=300, options=array() 2024-02-02 10:45:51 Connection failed. Error #2: stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed [/home/wwwroot/xiaobao/domain/www.azmnaturalbeauty.com/web/wp-includes/PHPMailer/SMTP.php line 396] 2024-02-02 10:45:51 Connection failed. Error #2: stream_socket_client(): Failed to enable crypto [/home/wwwroot/xiaobao/domain/www.azmnaturalbeauty.com/web/wp-includes/PHPMailer/SMTP.php line 396] 2024-02-02 10:45:51 Connection failed. Error #2: stream_socket_client(): Unable to connect to ssl://smtp.zoho.com.cn:465 (Unknown error) [/home/wwwroot/xiaobao/domain/www.azmnaturalbeauty.com/web/wp-includes/PHPMailer/SMTP.php line 396] 2024-02-02 10:45:51 SMTP ERROR: Failed to connect to server: (0) SMTP Error: Could not connect to SMTP host. Failed to connect to server Deprecated: Creation of dynamic property FluentSmtpDb\QueryBuilder\QueryBuilderHandler::$adapter is deprecated in /home/wwwroot/xiaobao/domain/www.azmnaturalbeauty.com/web/wp-content/plugins/fluent-smtp/app/Services/wpfluent/src/QueryBuilder/QueryBuilderHandler.php on line 67 Deprecated: Creation of dynamic property FluentSmtpDb\QueryBuilder\QueryBuilderHandler::$adapterConfig is deprecated in /home/wwwroot/xiaobao/domain/www.azmnaturalbeauty.com/web/wp-content/plugins/fluent-smtp/app/Services/wpfluent/src/QueryBuilder/QueryBuilderHandler.php on line 68 Deprecated: Creation of dynamic property FluentSmtpDb\QueryBuilder\QueryBuilderHandler::$adapter is deprecated in /home/wwwroot/xiaobao/domain/www.azmnaturalbeauty.com/web/wp-content/plugins/fluent-smtp/app/Services/wpfluent/src/QueryBuilder/QueryBuilderHandler.php on line 67 Deprecated: Creation of dynamic property FluentSmtpDb\QueryBuilder\QueryBuilderHandler::$adapterConfig is deprecated in /home/wwwroot/xiaobao/domain/www.azmnaturalbeauty.com/web/wp-content/plugins/fluent-smtp/app/Services/wpfluent/src/QueryBuilder/QueryBuilderHandler.php on line 68 请问如何解决?

0
1
0
浏览量187
七厦

如何在局域网中生成受信任的SSL证书?

局域网IP地址怎么生成受信任的SSL证书?比如启明星辰的设备ip地址证书就是受信任的。

0
1
0
浏览量180
梦想缔造狮

证书无效问题?

nginx 证书问题 已经使用自签名证书生成了一个证书, 并配置到 nginx 中了, 域名 CN 也配置正确了 然后在客户端 hosts 文件中也配置了对应映射 导入了对应的证书文件 然后访问域名, 说证书无效, 每次都到这里卡住, 不知道这证书哪里无效了, 我都导入到了受信任的根证书里面了, 并且在 chrome 的证书管理中也能看到 "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241011/537cd1efe1ed8851f8a599113321e112.png) "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241011/e71286ec39a923510023f7b5af9fb374.png)

0
1
0
浏览量157
Mia好纠结

如何让申请的免费ssl证书有颁发对象公用名及组织?

比如以下: 公用名 (CN) abc.com 组织 (O) abc有限公司

0
1
0
浏览量140
栀子花爷爷

AMH配置cloudflare的证书提示无效,求解?

站点已配置SSL,证书用的是cloudflare的,cloudflare中也新增了相应的DNS解析 "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241113/b98d92349d4763e53277763e19cb5d86.png) 访问的时候页面出现的是cloudflare的提示无效的SSL证书。 "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20241113/dd2b240142427a6e0dc25c2a975362a4.png) 证书尝试改成上传,结果还是不行,不知道哪儿出问题了。。。

0
1
0
浏览量26