Skip to main content
SoftHSM v2 can be built for Windows as both 32-bit and 64-bit binaries. The build produces softhsm2.dll — a standard PKCS#11 DLL that any compatible application can load. Two build methods are available: the legacy Visual Studio solution (using a Python-based configure script) and the modern CMake + vcpkg method.
The SQLite3 database object store backend is supported on Windows. It can be enabled with -DWITH_OBJECTSTORE_BACKEND_DB=ON (CMake) or with-objectstore-backend-db (legacy). This support was introduced in SoftHSM v2.7.0 (issue #717).

Build methods

Output files

A successful build produces the following files:
FileDescription
softhsm2.dllThe PKCS#11 library — load this in your application
softhsm2-util.exeToken management utility
softhsm2-keyconv.exeKey conversion utility
softhsm2-dump-file.exeObject store dump utility
The source tree under win32/ contains the Visual Studio project files for each component: softhsm2/, util/, keyconv/, dump/, and the test projects (cryptotest/, datamgrtest/, etc.).

Configuration

Configuration file

SoftHSM on Windows reads its configuration from a file pointed to by the SOFTHSM2_CONF environment variable. There is no fixed system-wide path. Copy the template configuration file from the source tree and set the token directory path:
copy C:\build\src\SoftHSMv2\src\lib\common\softhsm2.conf.in C:\SoftHSM\softhsm2.conf
Edit softhsm2.conf and replace @softhsmtokendir@ with your actual token directory, for example C:\SoftHSM\tokens:
# SoftHSM v2 configuration file
directories.tokendir = C:\SoftHSM\tokens
objectstore.backend = file
log.level = INFO
Create the token directory:
mkdir C:\SoftHSM\tokens
Set the environment variable so SoftHSM can find the file:
set SOFTHSM2_CONF=C:\SoftHSM\softhsm2.conf
To make this permanent, set SOFTHSM2_CONF in System Properties > Environment Variables.

Logging

On Windows, log output is sent to the Windows Event Log rather than syslog. The log level is controlled by log.level in softhsm2.conf. View events using Event Viewer (eventvwr.msc).

Known limitations on Windows

  • GOST algorithm support: The OpenSSL GOST engine is not supported with OpenSSL 1.1.0 and later. Pass disable-gost to Configure.py when using OpenSSL 1.1.0+.
  • Non-paged memory: Non-paged memory for secure key storage can cause issues in some environments. The CI build disables it with -DDISABLE_NON_PAGED_MEMORY=ON. You can disable it at configure time if needed.
  • No p11-kit integration: p11-kit is a Linux/macOS concept. There is no equivalent system-wide PKCS#11 module registry on Windows; applications must be configured to load softhsm2.dll directly.
  • Static CRT: If you mix static and dynamic CRT linkage across components, you will encounter linker errors. Ensure CppUnit and SoftHSM are built with the same CRT setting.

Build docs developers (and LLMs) love