Skip to main content

Prerequisites

The following tools must be installed before building SoftHSM v2 with Autotools:
  • autoconf, automake, libtool — GNU build system toolchain
  • pkg-config — helps the configure script locate installed libraries
  • OpenSSL (>= 1.0.0) or Botan (>= 2.0.0) — cryptographic backend (one is required)
  • CppUnit — required only to run the unit test suite
  • SQLite3 (>= 3.4.2) — required when building the migration tool (--with-migrate) or the database object store (--with-objectstore-backend-db)
  • libp11-kit-dev — required to register SoftHSM as a system PKCS#11 module
If you are using Botan, use version 2.6.0 or later. This improves performance for public key operations.

Build steps

1

Generate the configure script (git builds only)

If you cloned the source from the git repository rather than downloading a release tarball, you must generate the configure script before proceeding:
sh autogen.sh
This requires automake, autoconf, and libtool to be installed. Release tarballs already include the generated configure script; skip this step if you are building from a tarball.
2

Configure the build

Run ./configure with any options appropriate for your environment:
./configure
For a full list of available options:
./configure --help
3

Compile

make
4

Run unit tests (optional)

Requires CppUnit to be installed:
make check
5

Install

sudo make install

Configure options

Memory

OptionDescription
--disable-non-paged-memoryDisable non-paged memory for secure storage. Non-paged memory is enabled by default to prevent key material from being swapped to disk.

Algorithm support

All algorithm flags default to auto-detection based on what the selected crypto backend supports.
OptionDescription
--enable-eccEnable support for Elliptic Curve Cryptography (ECC).
--enable-gostEnable support for GOST algorithms.
--enable-eddsaEnable support for EdDSA (Ed25519, Ed448).
--enable-mldsaEnable support for ML-DSA (FIPS 204 post-quantum signature scheme).

Crypto backend

OptionDescription
--with-crypto-backend=openssl|botanSelect the cryptographic backend library. Defaults to OpenSSL.
--with-openssl=PATHSpecify the prefix path of a non-default OpenSSL installation.
--with-botan=PATHSpecify the prefix path of a non-default Botan installation.
# Example: use Botan from a custom prefix
./configure --with-crypto-backend=botan --with-botan=/opt/botan

Migration tool

OptionDescription
--with-migrateBuild the softhsm2-migrate tool for converting SoftHSM v1 token databases. Requires SQLite3.

Object store backend

OptionDescription
--with-objectstore-backend-dbBuild with the SQLite3 database object store as an alternative to the default file-based store.
--with-sqlite3=PATHSpecify the prefix path of a non-default SQLite3 installation.

p11-kit integration

OptionDescription
--disable-p11-kitDisable p11-kit integration. p11-kit integration is enabled by default when libp11-kit-dev is detected.
--with-p11-kit=PATHOverride the p11-kit module install path detected by pkg-config.

Visibility

OptionDescription
--disable-visibilityDisable hidden symbol visibility link mode. Hidden visibility is enabled by default.

Post-install

After sudo make install, the shared library is installed to the system library directory. On a typical Linux system the path is:
/usr/local/lib/softhsm/libsofthsm2.so
The exact path depends on the --prefix and --libdir values passed to ./configure. To confirm the installed location:
find /usr/local/lib /usr/lib -name 'libsofthsm2.so' 2>/dev/null
The default configuration file is /etc/softhsm2.conf. You can override this location by setting the SOFTHSM2_CONF environment variable.

Build docs developers (and LLMs) love