【问题标题】:HttpsURLConnection error: java.security.cert.CertPathValidatorException: Trust anchor for certification path not foundHttpsURLConnection 错误:java.security.cert.CertPathValidatorException:找不到证书路径的信任锚
【发布时间】:2018-06-25 17:45:41
【问题描述】:

以前,我们的网站是 Http,我使用 AsyncTask 和 HttpURLConnection 使用 API 发布数据,但现在它是 Https,当我将 HttpURLConnection 转换为 HttpsURLConnection 时出现此错误:

java.security.cert.CertPathValidatorException:找不到证书路径的信任锚。

我该怎么办?

【问题讨论】:

  • 首先检查忽略证书TrustManager。如果它有效,然后检查服务器是否接受自签名或哪个父证书。通常手机已经带有主要CA。
  • TrustManager 工作正常。谢谢!

标签: android android-asynctask httpurlconnection httpsurlconnection


【解决方案1】:

如我所述,要确定问题,首先尝试使用TrustManager 忽略certificate。如果它有效,然后检查server 是否接受self-signed 或哪个parent certificate。一般来说,devices 已经预装了大多数 CA 的 certificates .Here is a detailed link .

【讨论】:

    猜你喜欢
    • 2016-03-31
    • 2017-01-08
    • 2016-12-26
    • 1970-01-01
    • 2018-01-06
    • 2023-02-15
    • 2019-08-02
    • 2014-09-27
    相关资源
    最近更新 更多