name = value pair on its own line. Lines beginning with # are comments and are ignored, as are blank lines.
Configuration file location
The library searches for a configuration file in the following order:- The path set in the
SOFTHSM2_CONFenvironment variable. ~/.config/softhsm2/softhsm2.conf(user-specific; overrides the system-wide file when present).- The system-wide default, typically
/etc/softhsm2.conf.
On Windows the user-specific path is
%HOMEDRIVE%%HOMEPATH%\softhsm2.conf.Minimal example
directories
The directory where SoftHSM stores token data. The directory must exist and be writable before the library is loaded.Default: Create the directory before first use:
/var/lib/softhsm/tokens/objectstore
The storage backend used to persist token objects. Two backends are supported:See Object store backends for a detailed comparison.
file— one file per object in the token directory (default).db— a single SQLite3 database file per token. Requires the library to be compiled with--with-objectstore-backend-db.
fileAn additional file mode creation mask applied when SoftHSM creates files or directories inside the token directory. The value is in octal notation.This mask is applied on top of the process umask and cannot grant permissions that the process umask has already denied.Default:
0077 (owner read/write only; group and other access denied)Added in: 2.7.0log
The minimum severity level of messages that SoftHSM will emit. Messages below this level are silently discarded.Accepted values (from most to least verbose):
Default: See Logging for more details on log output and format.
| Value | Syslog equivalent | Description |
|---|---|---|
DEBUG | LOG_DEBUG | All internal tracing messages |
INFO | LOG_INFO | Notable operational events |
WARNING | LOG_WARNING | Non-fatal conditions |
ERROR | LOG_ERR | Errors only (default) |
ERRORPath to a file where log output is written. When set, log messages are written to this file instead of syslog. The file is opened in append mode.If the file cannot be opened, SoftHSM falls back to syslog and emits a warning.Default: (empty — log to syslog)When logging to a file, each line includes a timestamp, process ID, severity, and the source location:
slots
When
true, SoftHSM sets the CKF_REMOVABLE_DEVICE flag in the CK_SLOT_INFO structure returned by C_GetSlotInfo. Some applications use this flag to determine how to present the token to the user.Default: falseA comma-separated list of PKCS#11 mechanism names that controls which mechanisms are reported by
Default: See Mechanism configuration for the full list of supported mechanism names.
C_GetMechanismList and accepted by C_GetMechanismInfo.Syntax options:| Value | Behaviour |
|---|---|
ALL | All supported mechanisms are enabled (default) |
CKM_FOO,CKM_BAR | Only the listed mechanisms are enabled |
-CKM_FOO,CKM_BAR | All mechanisms except the listed ones are enabled |
ALLThis option takes precedence over the
CKA_ALLOWED_MECHANISMS attribute on key objects. Unknown mechanism names are silently ignored.library
Controls what happens to open PKCS#11 sessions when a process calls
fork(2).false— the child inherits all open sessions from the parent (default POSIX behaviour).true— the library resets its internal state in the child process, closing all sessions. This is safer for multi-process applications that fork after loading the library.
falseAdded in: 2.6.0