en English
X

Select Language

Powered by Google TranslateTranslate

We hope you will find the Google translation service helpful, but we don’t promise that Google’s translation will be accurate or complete. You should not rely on Google’s translation. English is the official language of our site.

en English
X

Select Language

Powered by Google TranslateTranslate

We hope you will find the Google translation service helpful, but we don’t promise that Google’s translation will be accurate or complete. You should not rely on Google’s translation. English is the official language of our site.

使用OpenSSL创建.pfx / .p12证书文件

请注意: 本文不适用于 SSL.com 代码签名和文档签名证书。 这些类型的证书无法生成为 .pfx 文件,并且无法导出其私钥。 SSL.com 代码签名和文档签名证书及其私钥只能生成并存储在 eSigner 云签名环境,以 Yubikey 设备,或支持的 云HSM.

在密码学中,PKCS#12 或 PFX 格式是一种二进制格式,通常用于将信任链的所有元素(例如服务器证书、任何中间证书和私钥)存储到单个可加密文件中。 PFX 文件通常带有扩展名 .pfx 和 .p12。 PFX 文件通常在 Windows 和 macOS 计算机上用于导入和导出证书和私钥。

岗位要求

  • 证书使用的原始私钥
  • PEM(.pem,.crt,.cer)或PKCS#7 / P7B(.p7b,.p7c)文件
  • OpenSSL的 (包括在Linux / Unix和macOS中,并通过以下方式轻松安装在Windows上: Cygwin的)

以下命令演示了如何使用OpenSSL在命令行中创建.pfx / .p12文件的示例:

PEM(.pem,.crt,.cer)转换为PFX

openssl pkcs12-导出-out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile more.crt

分解命令:

  • openssl –执行OpenSSL的命令
  • pkcs12 – OpenSSL中PKCS#12文件的文件实用程序
  • -export -out certificate.pfx –将PFX文件导出并保存为certificate.pfx
  • -inkey privateKey.key –使用私钥文件privateKey.key作为与证书结合的私钥。
  • -in certificate.crt –使用certificate.crt作为将与私钥合并的证书。
  • -certfile more.crt –这是可选的,这是如果您要在PFX文件中包括任何其他证书。
输入命令后,将提示您输入并验证导出密码以保护PFX文件。 记住这个密码! 当您希望导出证书和密钥时,将需要它。
如果您要创建PFX 在Azure Web Apps上安装,或要求PFX文件用于SSL /的其他服务TLS 安装时,建议在您的PFX中包含完整的信任链。 您可以通过下载 阿帕奇 从您的SSL.com帐户下载链接,其中包括您的网站证书和名为 ca-bundle-client.crt 在您的PFX文件中。 例如:

openssl pkcs12-导出-out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile ca-bundle-client.crt

Apache下载链接

PKCS#7 / P7B(.p7b,.p7c)到PFX

P7B文件不能用于直接创建PFX文件。 P7B文件必须转换为PEM。 转换为PEM后,请按照上述步骤从PEM文件创建PFX文件。

openssl pkcs7 -print_certs -in 证书.p7b -out 证书.crt

分解命令:

  • openssl –执行OpenSSL的命令
  • pkcs7 – OpenSSL中PKCS#7文件的文件实用程序
  • -print_certs -in certificate.p7b –打印出文件中包含的所有证书或CRL。
  • -out certificate.crt –将文件输出为certificate.crt
请注意: 您也可以使用OpenSSL 提取 PKCS#12 / PFX文件中的证书和私钥。

如需更多有用的操作方法和最新的网络安全新闻,请在此处订阅 SSL.com 的时事通讯: 

 

视频

https://www.youtube.com/watch?v=-i7ugO8AVN4
感谢您选择SSL.com! 如有任何疑问,请通过电子邮件与我们联系 Support@SSL.com,致电 1-877-SSL-SECURE,或只需单击此页面右下方的聊天链接。 您还可以在我们的网站上找到许多常见支持问题的答案 知识库.

订阅 SSL.com 的时事通讯

不要错过SSL.com上的新文章和更新