Android SSL HttpUrlConnection 提示 hostname "ip" was not verified

2017-03-24 15:06:58 +08:00
 Vindroid

局域网内服务器使用自签名证书 server.csr Certificate Request:

Data:
    Version: 0 (0x0)
    Subject: C=CN, ST=JiangSu, L=xxx, O=xxx, OU=xxx, CN=10.89.33.52
    Subject Public Key Info:
        Public Key Algorithm: rsaEncryption
            Public-Key: (2048 bit)
            Modulus:
                *****
            Exponent: 65537 (0x10001)
    Attributes:
        unstructuredName         :unable to print attribute
    Requested Extensions:
        X509v3 Basic Constraints:
            CA:FALSE
        X509v3 Key Usage:
            Digital Signature, Non Repudiation, Key Encipherment
        X509v3 Subject Alternative Name:
            DNS:10.89.33.52
Signature Algorithm: sha256WithRSAEncryption
     *****

在 android 下通过 httpurlconnection 连接会报 hostname "10.89.33.52" was not verified ,而使用域名,再在 etc/hosts 中新增条目,却可以正常访问,有人知道这是什么情况么?

设置的 ip 均为保留地址, server.crt 证书也导入到 android 中,浏览器能正常访问,也显示为认证通过。

1991 次点击
所在节点    问与答
0 条回复

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/350052

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX