err_cert_authority_invalid - 自签名 CA 在 android 上无效,但在 PC 上有效

err_cert_authority_invalid - self signed CA is invalid on android, but works on PC

我正在测试 https 网络服务器,但在尝试从我的 android phone.

访问它时遇到问题

执行的步骤:

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

  2. 运行 golang(也试过 nodejs)网络服务器,后面跟着 cert/key 对: 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. 在桌面 Google Chrome 中添加了 myCA.pem 作为受信任的授权机构并且有效;

  4. 在android证书存储中添加了与受信任机构相同的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

感觉我在服务器证书上做错了(但错误指的是 CA)and/or 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>

而且它在两个平台上都运行良好。