What is SoftHSM?
SoftHSM is a software implementation of a generic cryptographic device with a PKCS#11 interface. It was originally developed as part of the OpenDNSSEC project and is now a standalone project. OpenDNSSEC handles and stores its cryptographic keys via the PKCS#11 interface. This interface specifies how to communicate with cryptographic devices such as HSMs (Hardware Security Modules) and smart cards. The purpose of these devices is to generate cryptographic keys and sign information without revealing private-key material to the outside world. SoftHSM removes the requirement for physical hardware, making it possible to develop against the PKCS#11 interface and test cryptographic workflows without the cost and complexity of a real HSM.Installation
Build and install SoftHSM v2 on your system using Autotools or CMake
Configuration
Configure the softhsm2.conf file, object store, logging, and mechanisms
Token Management
Initialize tokens, manage slots, and back up your token store
PKCS#11 Reference
Full reference for all PKCS#11 functions implemented by SoftHSM
CLI Tools
Use softhsm2-util, softhsm2-keyconv, and other command-line tools
Crypto Backends
Choose between OpenSSL and Botan cryptographic backends
Key features
- Full PKCS#11 v3.2 implementation — Drop-in software replacement for hardware HSMs. Link your application to
libsofthsm2.sojust as you would a real HSM. - Multiple algorithm support — RSA, DSA, ECDSA, ECDH, EdDSA (Ed25519/Ed448), DH, GOST, and ML-DSA (post-quantum lattice-based signatures).
- Pluggable crypto backends — Choose between OpenSSL (default) or Botan for the underlying cryptographic operations.
- Flexible object stores — Store tokens as files on disk or in a SQLite3 database backend.
- p11-kit integration — Register
libsofthsm2.soas a system-wide PKCS#11 module via p11-kit. - FIPS 140-2 capable — When linked against a FIPS-capable OpenSSL build.
- Cross-platform — Linux, macOS, and Windows.
How it works
SoftHSM presents itself as a standard PKCS#11 shared library (libsofthsm2.so on Linux/macOS, softhsm2.dll on Windows). Any application that supports PKCS#11 can load this library and use it to:
- Manage cryptographic tokens and slots
- Generate and store symmetric and asymmetric keys
- Perform signing, verification, encryption, and decryption
- Derive keys and generate random data
Intended use cases
SoftHSM is designed for development, testing, and environments where a physical HSM is not available. It does not provide the tamper-resistance guarantees of real hardware HSMs.
- Development and testing — Develop PKCS#11-based applications without physical hardware.
- OpenDNSSEC deployments — The original and primary use case: DNSSEC key storage and signing.
- CI/CD pipelines — Run cryptographic operations in automated pipelines.
- Reference implementation — Understand PKCS#11 behavior against a known-good implementation.
Quick start
Install dependencies
Install a cryptographic library (OpenSSL ≥ 1.0.0 or Botan ≥ 2.0.0) and build tools.
Configure
Create the default configuration file at Then create the token directory:
/etc/softhsm2.conf: