Tested distributions
- Debian and Ubuntu (stable releases)
- RHEL, CentOS, and Fedora
Install dependencies
- Debian / Ubuntu
- RHEL / CentOS / Fedora
Build and install
Prepare the build system
If you cloned the repository directly (rather than downloading a release tarball), generate the configure script first:
Configure
| Option | Description |
|---|---|
--with-crypto-backend=openssl|botan | Select the cryptographic backend |
--with-objectstore-backend-db | Enable the SQLite3 object store |
--with-migrate | Build the SoftHSM v1 migration tool (requires SQLite3) |
--disable-non-paged-memory | Disable non-paged (locked) memory |
--disable-p11-kit | Disable p11-kit integration |
--with-p11-kit=PATH | Override the p11-kit module install path |
./configure --help for the full list of options.Default install paths
After installation, the key files are placed at:| File | Default path |
|---|---|
| PKCS#11 library | /usr/local/lib/softhsm/libsofthsm2.so |
| Configuration file | /etc/softhsm2.conf |
softhsm2-util | /usr/local/bin/softhsm2-util |
SOFTHSM2_CONF environment variable:
Logging
On Linux, SoftHSM sends log output to syslog. The log level is controlled by thelog.level setting in softhsm2.conf:
ERROR, WARNING, INFO, and DEBUG. Each log entry is prefixed with the source file name and line number.
To view SoftHSM log output:
Non-paged memory (mlock)
By default, SoftHSM uses non-paged memory (mlock) to prevent sensitive key material from being swapped to disk.
To allow a non-root user to lock memory, grant the CAP_IPC_LOCK capability to the binary:
memlock limit for the user in /etc/security/limits.conf:
p11-kit integration
p11-kit provides a standard way to register PKCS#11 modules system-wide on Linux. Applications that use p11-kit (such as GnuTLS and NSS) will automatically discover SoftHSM when it is registered.Install the p11-kit development package
- Debian / Ubuntu
- RHEL / CentOS / Fedora
Build with p11-kit support
p11-kit integration is enabled by default whenlibp11-kit-dev is present. To build without it:
Register the module
After installation, SoftHSM registers itself by placing a module descriptor file in the p11-kit search path (typically/usr/share/p11-kit/modules/ or /etc/pkcs11/modules/). You can verify that p11-kit discovers it: