ssl - 使用包括中间证书在内的 key 将 PFX 转换为 PEM

标签 ssl openssl ssl-certificate

我有一个 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/

相关文章:

ssl - OpenSSL 客户端证书与服务器证书

php - SSL证书问题: unable to get issuer certificate

windows-phone-7 - 为什么此 SSL 证书在浏览器中可以正常验证,但在 .NET/Silverlight 中却不行?

windows - 鱿鱼透明+ HTTPS

android - 使用 SpongyCaSTLe 从 PKCS#10 创建带有客户端证书的 Https 连接

ruby - 使用 Mechanize 对象获取 `certificate verify failed (OpenSSL::SSL::SSLError)` 错误

java - 如何在java中使用RSA key 加密解密

openssl - 我自己/小型组织的证书颁发机构

certificate - 如何自动将 Windows 根证书导出到文件?

ssl - 是否可以将从 CA 获得的证书转换为 PEM 格式?