从 .pfx 文件中提取证书和私钥文件

有时需要从 Windows 计算机导出证书和私钥,以分离证书和密钥文件以供其他地方使用。

Windows 不提供完成此过程的方法。

从 Windows 证书存储中导出证书描述了如何将证书和私钥导出到单个 .pfx 文件中。
按照以下过程从 .pfx 文件中提取单独的证书和私钥文件。

获取您导出的文件(例如 certname.pfx)并将其复制到安装了 OpenSSL 的系统中。
注意:*.pfx 文件为 PKCS#12 格式,包括证书和私钥。

  1. 运行以下命令导出私钥:openssl pkcs12 -in certname.pfx -nocerts -out key.pem -nodes

  2. 运行以下命令导出证书:openssl pkcs12 -in certname.pfx -nokeys -out cert.pem

  3. 运行以下命令以从私钥中删除密码:openssl rsa -in key.pem -out server.key


相关文章

回到首页 发表评论 回到顶部