pkcs11js is a Typescript/Javascript binding for PKCS#11, enables Node applications to interact with PKCS#11 implementations such as provided by smart cards and hardware security modules.
Sample | Description |
---|---|
RSA key generation and data signing | Demonstrates how to generate an RSA key pair, sign some data with the private key, and verify the signed data with the public key, interacting with a software HSM through the PKCS#11 API. |
Certificate importing | Demonstrates how to create an X509 certificate object on the HSM. |
Key and Certificate getting | Demonstrates searching for objects on a token based on a specified CKA_ID attribute value and, if found, outputs their type names. |
These examples require any PKCS#11 library on your computer. I use SoftHSM for these examples. You can install it on Mac using this command.
brew install softhsm
softhsm2-util --init-token --so-pin "12345" --pin "12345" --slot 0 --label "My slot 0"