Introduction
https://github.com/oasis-tcs/pkcs11
PKCS#11
是由RSA Laboratories提出的一组公钥密码学标准(称为“Public-Key Cryptography Standards”)中的一部分,也被称为Cryptographic Token Interface Standard 。它定义了一套通用的API接口,用于与加密令牌(如硬件安全模块HSM、智能卡、USB安全密钥等)进行交互,实现密钥管理、数据加密、数字签名等安全操作。
PKCS#11
的核心目标是提供一个独立于厂商的编程接口,使应用程序能够在不依赖特定硬件的情况下访问各种加密设备,从而提升系统的兼容性与灵活性。该标准支持多种密码算法,包括
RSA
、
AES
、
ECC
等,并具备对用户身份认证、对象管理(如密钥存储)、会话管理和访问控制的支持。
由于其良好的抽象能力和广泛适用性,PKCS#11
被大量应用于金融、政务、云计算和网络安全等领域,尤其是在需要高安全性的系统中,作为保护敏感密钥和执行关键安全操作的标准接口。
Related:
Hardware Security Module
Smart Card
OpenSC
https://github.com/OpenSC
https://github.com/OpenSC/OpenSC
Open source smart card tools and middleware. PKCS#11/MiniDriver/Tokend
Yubikey
h
h
This is a PKCS#11 module that allows external applications to communicate with the PIV application running on a YubiKey.
SoftHSM
https://github.com/softhsm/SoftHSMv2
OpenDNSSEC handles and stores its cryptographic keys via the PKCS#11 interface. This interface specifies how to communicate with cryptographic devices such as HSM:s (Hardware Security Modules) and smart cards. The purpose of these devices is, among others, to generate cryptographic keys and sign information without revealing private-key material to the outside world. They are often designed to perform well on these specific tasks compared to ordinary processes in a normal computer.
Logger
https://github.com/Pkcs11Interop/pkcs11-logger
PKCS#11 logging proxy module
Application <--> PKCS11-LOGGER library <--> PKCS#11 library <--> Device
Tools
Firefox
Firefox 浏览器原生支持 PKCS#11 标准,允许用户通过标准接口与硬件安全模块(HSM)、智能卡、USB加密令牌等设备进行交互,从而实现基于数字证书的身份认证、客户端SSL/TLS认证、数字签名等功能。
OpenSSH
OpenSSH 自 版本 8.2 起增强了对 PKCS#11 的支持,允许用户通过符合 PKCS#11 标准的硬件安全模块(HSM)、智能卡或加密令牌来管理和使用 SSH 密钥。这种集成提升了 SSH 认证的安全性,因为私钥可以被安全地存储在硬件设备中,而不会暴露给操作系统或应用程序。
OpenSSL
OpenSSL 本身并不直接内置完整的 PKCS#11 接口支持,但它可以通过一个名为 engine_pkcs11
的插件模块与符合 PKCS#11 标准的硬件安全模块(HSM)、智能卡或 USB 加密令牌进行交互。这种集成使得 OpenSSL 可以使用存储在安全设备中的私钥来执行签名、加密等操作,而无需将私钥导出到内存中,从而显著提升安全性。
Programming
Golang JWT PKCS#11
https://github.com/salrashid123/golang-jwt-pkcs11
Generate and verify JWT tokens with PKCS-11
TPM2 PKCS#11
https://github.com/tpm2-software/tpm2-pkcs11
A PKCS#11 interface for TPM2 hardware