在 PHP 中从 PFX 证书中提取 RSA 私钥

发布于 2025-01-12 23:14:25 字数 269 浏览 5 评论 0原文

如何从 PHP 中的 .PFX 证书中提取 RSA 私钥?我在终端中使用了这个命令,它工作正常,

openssl pkcs12 -in cert.pfx -nocerts -nodes -passin pass:1234 | openssl rsa -out privkey.pem

我基本上需要执行与该命令相同的操作,但是在 PHP 中,当用户上传文件时,我尝试使用 openssl_pkcs12_read 但它没有 RSA 私钥。

How can I extract RSA PRIVATE KEY from .PFX certificate in PHP? I used this command in terminal and it works

openssl pkcs12 -in cert.pfx -nocerts -nodes -passin pass:1234 | openssl rsa -out privkey.pem

I basically need to do the same as that command but in PHP when user uploads their file, I've tried with openssl_pkcs12_read but it doesn't have RSA PRIVATE KEY.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文