My previous question询问如何指定配置文件和命令,以便我可以通过 HTTPS 在本地连接上连接到我的 Web 服务器。
我已经想通了,并将证书添加到我的 Android 手机的受信任证书存储中,但出于某种原因,Android 上的 Chrome 仍然显示 "The identity of this website has not been verified. Server's certificate is not trusted."
我认为问题可能是因为它不是根证书,Android 仍然不信任它?我搜索了一下,似乎有人在谈论如何设置 basicConstraints
至CA:TRUE
可能会解决它,但您可能还需要使用 Key Usage
也?
我尝试了几种建议方法的排列,但似乎没有任何效果。我的问题很简单:我需要使用什么配置才能让 Android 上的 Chrome 接受我的自签名证书有效?我想在我的开发环境中本地调试推送通知,它们需要 HTTPS。
这是我当前用于生成证书的配置,它允许 Chrome 连接(通过 https://192.168.1.155:8080
),但仍然显示“服务器的证书不受信任”。是否可以更改它以纠正此错误?
请求.cnf:
[req]
distinguished_name = req_distinguished_name
x509_extensions = v3_req
prompt = no
[req_distinguished_name]
C = US
ST = VA
L = SomeCity
O = MyCompany
OU = MyDivision
CN = localhost
[v3_req]
keyUsage = critical, digitalSignature, keyAgreement
extendedKeyUsage = serverAuth
subjectAltName = DNS:localhost,IP:192.168.1.155,IP:127.0.0.1
openssl req -newkey rsa:2048 -x509 -nodes -keyout key.pem -new -out cert.pem -config req.cnf -sha256 -days 3650
最佳答案
据我所知,你不能不进入每个浏览器(如每个设备)并禁用某些安全标志。
您不使用 Lets Encrypt 有什么原因吗?它是免费的,目前唯一的缺点是 90 天证书,您可以编写脚本来轻松更新。
关于android - 如何生成适用于 Android Chrome 浏览器的根证书?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60046410/