如何在 PHP 中与 PKCS#11 兼容的 HSM 设备交互

发布于 2024-09-09 07:03:13 字数 114 浏览 2 评论 0原文

如何在 Linux 服务器上运行的 PHP 应用程序中使用来自 PKCS#11 兼容 HSM(例如 SafeNet iKey 2032 [USB] 或 Aladdin eToken PRO [USB])的密钥材料?

How can I use key material from a PKCS#11 compliant HSM (for example a SafeNet iKey 2032 [USB] or a Aladdin eToken PRO [USB]) in PHP application running on a Linux server?

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

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

发布评论

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

评论(4

后知后觉 2024-09-16 07:03:13

我还没有看到,粗略搜索也没有找到 PHP 的 PCKS#11 粘合库。可能不是您正在寻找的答案。 (:如果您的搜索能力比我更好,请更新此线程。

我认为您最好的选择是编写一个调用 PKCS#11 并访问 HSM 的 C 程序,并从您的 PHP 应用程序中将其作为外部二进制文件调用。即使针对 PHP 出现了 PKCS#11 包装器,这种方法也将为您提供可用于 C 代码的完整 API,而不必使用包装器作者满足其自身需求所需的任何内容。 API 和包装器实现通常不完整。

I have not seen, and a cursory search has not found, a PCKS#11 glue library for PHP. Probably not the answer you're looking for. (: If you have better search fu than I, do update this thread.

I think your best bet would be to write a C program that calls PKCS#11 and accesses the HSM, and call that from your PHP app as an external binary. Even if a PKCS#11 wrapper emerges for PHP, this approach will give you the full API available to the C code rather than having to make do with whatever the author of the wrapper needed to satisfy their own requirements. PKCS#11 is a large API, and wrapper implementations are often less than complete.

翻了热茶 2024-09-16 07:03:13

您需要查看 OpenSC 项目中的 pkcs11-helper 。如果您尝试直接从 PHP 访问 PKCS#11 模块,这将是一个困难的方法。

You need to look at the pkcs11-helper from OpenSC project. It will be a hard way if you will try to access the PKCS#11 module directly from PHP.

余生一个溪 2024-09-16 07:03:13

您应该使用 php-pkcs11,它允许将您的私钥保存到基于 Oasis 组织的 PKCS11 标准的 HSM(硬件保管库)中。请参阅:https://github.com/gamringer/php-pkcs11

您的 HSM 可以是USB 记忆棒、TPM 或智能卡。

You should use php-pkcs11 which allows keeping your private keys into a HSM (Hardware vault) based on the PKCS11 standard from the Oasis organisation. See: https://github.com/gamringer/php-pkcs11

Your HSM can be a USB stick, a TPM or a SmartCard.

站稳脚跟 2024-09-16 07:03:13

我假设您正在询问用户使用其令牌生成签名的情况。签名是在客户端(即浏览器)生成的。事实上你的解决方案是在 linux/php 上并不重要。

您必须添加一个称为签名者的软件组件,它将读取证书并生成签名。

现有的开源签名器都是用 Java 编写的,因为 Java 小程序仍然是最可用的客户端技术。

i am assuming you are asking about users using their tokens to generate signatures. the signatures are generated on the client side, i.e. in the browser. the fact that your solution is on linux/php does not matter.

you have to add a software component called a signer, which will read the certificate and generate the signature.

existing open source signers are written in java, with the reason that a java applet is still the most available client side technology.

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