使用OpenSSL将PKCS#12证书转换为PEM [英] Converting PKCS#12 certificate into PEM using OpenSSL

查看:1518
本文介绍了使用OpenSSL将PKCS#12证书转换为PEM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 7上安装了OpenSSL x64,这是从 openssl-for-windows Google代码。我试图运行:

  openssl pkcs12 -export -inpath.p12-outnewfile.pem

但我得到一个错误。

 无法加载私钥

如何使用OpenSSL从PKCS#12存储中提取PEM中的证书?

解决方案

  openssl pkcs12 -in path.p12 -out newfile.crt.pem -clcerts -nokeys 
openssl pkcs12 - in path.p12 -out newfile.key.pem -nocerts -nodes

之后,您可以: / p>


  • 在newfile.crt.pem中的证书

  • newfile.key.pem中的私钥



要将证书和密钥放在同一个文件中,请使用以下



  openssl pkcs12 -in path.p12 -out newfile.pem 


I have OpenSSL x64 on Windows 7 which I downloaded from openssl-for-windows on Google Code. I'm attempting to run:

openssl pkcs12 -export -in "path.p12" -out "newfile.pem" 

but I get an error.

unable to load private key

How do I extract the certificate in PEM from PKCS#12 store using OpenSSL?

解决方案

Try:

openssl pkcs12 -in path.p12 -out newfile.crt.pem -clcerts -nokeys
openssl pkcs12 -in path.p12 -out newfile.key.pem -nocerts -nodes

After that you have:

  • certificate in newfile.crt.pem
  • private key in newfile.key.pem

To put the certificate and key in the same file use the following

openssl pkcs12 -in path.p12 -out newfile.pem

这篇关于使用OpenSSL将PKCS#12证书转换为PEM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆