我有SSL .crt文件,并且我想为节点HTTPS提供两个文件#1 key.pem和#2 cert.pem。

任何人有任何想法,我怎么能生成这些文件?

提前致谢。

最佳答案

如果要生成自签名证书,请执行以下命令(这些命令将在./config/sslcerts文件夹中生成证书文件)

mkdir -p ./config/sslcerts
openssl genrsa -out ./config/sslcerts/key.pem 4096
openssl req -new -key ./config/sslcerts/key.pem -out ./config/sslcerts/csr.pem
openssl x509 -req -days 365 -in ./config/sslcerts/csr.pem -signkey ./config/sslcerts/key.pem -out ./config/sslcerts/cert.pem
rm ./config/sslcerts/csr.pem
chmod 600 ./config/sslcerts/key.pem ./config/sslcerts/cert.pem

关于node.js - 如何将SSL .crt文件转换为Node.js HTTPS的key.pem和cert.pem,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/43367329/

10-13 08:28