【问题标题】:err_cert_authority_invalid - self signed CA is invalid on android, but works on PCerr_cert_authority_invalid - 自签名 CA 在 android 上无效,但在 PC 上有效
【发布时间】:2020-04-25 01:34:10
【问题描述】:

我正在测试 https 网络服务器,但在尝试从我的 Android 手机访问它时遇到了问题。

  • 使用的软件:Google Chrome 并封装到网站的 WebView 版本中;
  • 设备:运行 android 10 的 google pixel 3a,带有 android 8 的 android studio 模拟器。

执行的步骤:

  1. 使用此脚本:Getting Chrome to accept self-signed localhost certificate,我为我的服务器生成了证书和密钥,以通过 IP 访问它:192.168.0.101(在脚本中将 DNS alt_name 替换为 IP);

  2. 运行 golang(也尝试过 nodejs)网络服务器,并带有以下证书/密钥对: http.ListenAndServeTLS("192.168.0.101:8443", "/home/username/ssl/192.168.0.101.crt", "/home/username/ssl/192.168.0.101.key", router)

  3. 在桌面谷歌浏览器中添加了myCA.pem作为受信任的权威,它可以工作;

  4. 在 android cert 存储中添加了相同的 myCA.pem 作为受信任的权限,尝试重启 chrome/device 但仍然无效。

Not sure is it important but this is how it looks on PC

And on Android phone under User tab in Trusted Credentials

【问题讨论】:

    标签: android ssl ca


    【解决方案1】:

    感觉好像我在服务器证书(但错误提到 CA)和/或 CA 上做错了,我不知道为什么它可以在 PC 上运行。

    我已经使用以下设置重新创建了所有证书:

    CN=localhost
    [alt_names]
    IP.1=127.0.0.1
    IP.2=192.168.0.101
    IP.3=<external_ip_here_to_check_from_the_web>
    

    它在两个平台上都能正常工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-28
      • 1970-01-01
      • 1970-01-01
      • 2019-03-16
      • 2017-03-14
      • 1970-01-01
      相关资源
      最近更新 更多