【问题标题】:javax.net.ssl.SSLException: SSL handshake aborted Connection reset by peer while calling webservice from Android 7.0 Nougatjavax.net.ssl.SSLException:从 Android 7.0 Nougat 调用 web 服务时,SSL 握手中止连接由对等方重置
【发布时间】:2017-02-02 01:21:02
【问题描述】:

我正在调用 https webservice,它在所有其他版本的 Android 中都可以正常工作,但是现在,当我尝试使用 Android 7.0 Nougat 调用它时,它给了我以下错误。

错误:javax.net.ssl.SSLHandshakeException: Connection closed by peer

我已经尝试过使用 HttpClient 和 HttpsURLConnection,但我得到了同样的错误。

我使用了 google 提供的Security with HTTPS and SSL,但在 Android 7.0 Nougat 中遇到了同样的错误

【问题讨论】:

  • 检查这个答案,对我有用,解决方案适用于 Volley,但可以应用于任何link

标签: android


【解决方案1】:

默认情况下,来自所有应用的安全连接(使用 TLS 和 HTTPS 等协议)信任预安装的系统 CA,而面向 Android 6.0(API 级别 23)及更低版本的应用也默认信任用户添加的 CA 商店。

这意味着在 Nougat 上,您实际上需要指定一个证书来信任您的 Android 项目。您可以将证书添加到配置文件中,如下所述: https://developer.android.com/training/articles/security-config.html

【讨论】:

    猜你喜欢
    • 2014-01-11
    • 2019-11-23
    • 2016-06-10
    • 2017-07-17
    • 2017-02-08
    • 2021-01-01
    • 2016-05-29
    • 2021-04-28
    • 2018-02-09
    相关资源
    最近更新 更多