安装 openssl 生成的 p12 密钥时 Windows 要求输入 p12 密码

发布于 2024-08-25 05:51:28 字数 204 浏览 3 评论 0原文

如果我使用 openssl 生成 p12 证书为:

openssl pkcs12 -export -in myprivatecert.pem -nokeys -out mycert.p12

即使我要求 openssl 不要导出私钥,为什么 Windows 在安装证书时仍然需要私钥密码。

我想我错过了一些东西。

If I generate a p12 certificate with openssl as:

openssl pkcs12 -export -in myprivatecert.pem -nokeys -out mycert.p12

Even though I ask openssl to not export the private key, why does windows still require the private key password when installing the certificate.

I figure I am missing something.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

萌辣 2024-09-01 05:51:28

密码是 PKCS12 文件本身的密码,而不是私钥的密码。您可以通过添加“-password pass:”来指定空白密码,如下所示:

$ openssl pkcs12 -password pass: -export -in myprivatecert.pem -nokeys -out mycert.p12

Windows 仍会提示您输入密码,但您可以将其保留为空,导入将正常进行。

如果您在 Windows 上导入的只是证书,没有密钥,您还可以使用 DER 格式,如下所示:

$ openssl x509 -in myprivatecert.pem -outform DER -out mycert.der

这样做的一个好处是,当您在 Windows 上双击此文件时,它会识别 der 扩展名,并且您可以使用 DER 格式。可以在导入前查看证书详细信息。此外,也不会出现密码提示。

The password is for the PKCS12 file itself, not for the private key. You can specify a blank password by adding "-password pass:" like this:

$ openssl pkcs12 -password pass: -export -in myprivatecert.pem -nokeys -out mycert.p12

You will still be prompted by Windows for the password, but you can leave it empty, and the import will work fine.

If all you are importing on Windows is the certificate, without the key, they you can also use the DER format like this:

$ openssl x509 -in myprivatecert.pem -outform DER -out mycert.der

One benefit of this is that when you double-click this file on Windows, it recognizes the der extension, and you can view the certificate details just before importing. Also, there will be no password prompt.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文