【问题标题】:Android DownloadManager Trust anchor for certification path not foundAndroid DownloadManager 未找到证书路径的信任锚
【发布时间】:2019-01-02 15:39:41
【问题描述】:

我搜索了很多帖子,但没有找到任何解决方案或问题的答案。 如何从安装了中间证书的站点下载文件? 使用 DownloadManager 时,我收到错误“java.security.cert.CertPathValidatorException:找不到证书路径的信任锚”。尝试下载文件时。我已经看到了我应该在这篇文章中使用类似 https://developer.android.com/training/articles/security-ssl#java 的帖子 但我真的不知道我应该如何为下载管理器设置 SslSocketFactory 以便他可以使用它来下载文件。

【问题讨论】:

    标签: android download anchor trust


    【解决方案1】:

    好的,我找到了解决方案。 只需添加到您的清单中

    并使用以下代码行来 res -> xml -> 新文件 network_security_config

    <?xml version="1.0" encoding="utf-8"?>
    <network-security-config>
        <domain-config>
            <domain includeSubdomains="true">example.pl</domain>
        <trust-anchors>
            <certificates src="@raw/path_to_cert"/>
        </trust-anchors>
    </domain-config>
    </network-security-config>
    

    【讨论】:

      猜你喜欢
      • 2022-01-06
      • 2017-01-08
      • 2019-02-24
      • 1970-01-01
      • 1970-01-01
      • 2020-04-25
      • 2020-11-08
      • 2013-09-28
      相关资源
      最近更新 更多