我有一个 PFX,我想将其转换为 CRT 和 key 或 PEM 和 key 以安装在 NGINX 端点上。当我将 pfx 导入我的 Windows 机器上的证书库时,它会创建证书、中间链和根 CA。
如果我使用该 PFX 并运行以下 openssl 命令并将其绑定(bind)到端点,我不会获得链中的所有证书:
openssl pkcs12 -in ./GoDaddy.pfx -clcerts -nokeys -out pcc.crt -nodes -nokeys
openssl pkcs12 -in ./GoDaddy.pfx -nocerts -nodes -out pcc.rsa -nodes -nokeys
是否有一个开关或命令我可以运行以将 PFX 转换为 crt/rsa 或 pem/key 以及链上到根 CA 的所有证书?
最佳答案
既然你想要一切,你只需要减少你要求的限制数量。
所以:
openssl pkcs12 -in ./GoDaddy.pfx -out ./GoDaddy.pem
如果您阅读 documentation你会看到你要的是什么:
-nocerts
No certificates at all will be output.
-clcerts
Only output client certificates (not CA certificates).
-nokeys
No private keys will be output.
-nodes
Don't encrypt the private keys at all.
关于ssl - 使用包括中间证书在内的 key 将 PFX 转换为 PEM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54585465/