我想在 https localhost 上测试我的网络应用程序。不幸的是,似乎不可能从 chrome 中删除证书警告。首先,我生成了这样的证书:
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/localhost-selfsigned.key -out /etc/ssl/certs/localhost-selfsigned.crt
Run Code Online (Sandbox Code Playgroud)
然后我想将它添加到 Chrome,设置 > 高级 > 管理证书 - > 导入。我尝试导入之前生成的 .crt 文件,我得到的只是:
证书导入错误:此客户端证书的私钥丢失或无效。
我用谷歌搜索它,但我发现没有任何帮助。
我还尝试启用 allow-insecure-localhost 标志并打开 chrome with--ignore-certificate-errors但它仍然显示警告和损坏的 https
还有其他方法还是我在证书上做错了什么?