在 Windows 上生成 cert.pem 和 key.pem

Ale*_*and 6 ssl openssl certificate ssl-certificate

我需要生成一个cert.pemkey.pem文件来使用 Nginx 加密 http 请求。

在 Linux 上,我将执行以下 OpenSSL 命令:

openssl req -x509 -newkey rsa:4096 -nodes \
          -out ./nginx/config/cert.pem \
          -keyout ./nginx/config/key.pem -days 365
Run Code Online (Sandbox Code Playgroud)

在 Windows 上生成此类文件的等效命令是什么?我遵循了本指南,但它只生成一个.crt.key文件。

https://helpcenter.gsx.com/hc/en-us/articles/115015960428-How-to-Generate-a-Self-Signed-Certificate-and-Private-Key-using-OpenSSL

Ale*_*and 4

从上面的评论中收集答案:

如果您将 openssl 安装到 Windows 上,那么它是相同的命令。

或者

将 privateKey.key 重命名为 key.pem,将certificate.crt 重命名为 cert.pem。应该可以正常工作

或者

我还创建了一个 OpenSSL Docker 容器,它允许生成证书,而无需在 Windows 或 Linux 上安装 OpenSSL(假设您已经安装了 Docker): https: //github.com/alexisrolland/docker-openssl