libcryptohub-pkcs11.so), and wiring your environment so an OpenSSL 3.x consumer can reference a CryptoHub-stored key by a pkcs11: URI.
OpenSSL 3.x uses providers rather than the legacy ENGINE interface, so this integration uses Latchset pkcs11-provider 1.2.0 rather than the older libp11/libengine-pkcs11-openssl ENGINE. Install the provider separately; it is not shipped inside the CryptoHub endpoint download.
Install the OpenSSL pkcs11 provider
Ubuntu/Debian
-
In a terminal, install the provider package:
Red Hat/CentOS/Rocky
-
In a terminal, install the provider package:
-
Confirm the location of the installed OpenSSL provider module (
pkcs11.so) so you can reference it in the next step:The typical location on Ubuntu/Debian is/usr/lib/x86_64-linux-gnu/ossl-modules/pkcs11.so.
pkcs11-provider, build the v1.2.0 tag from Latchset’s source repository with meson and ninja. Note where pkcs11.so is installed; that path is the module value in the OpenSSL configuration below.
Create a dedicated OpenSSL provider configuration file
Create a dedicated OpenSSL configuration file for your application rather than editing the system-wideopenssl.cnf. This activates the pkcs11 provider and points pkcs11-module-path at the CryptoHub module installed with the CryptoHub Client Library.
-
Create
/etc/<product>/openssl-cryptohub.cnfwith the following contents. Adjustmoduleto the location of the provider module (pkcs11.so) from the install step, andpkcs11-module-pathto the location oflibcryptohub-pkcs11.so(the endpoint download provides this module; place it where the loader can reach it, such as/usr/local/lib/libcryptohub-pkcs11.so):Provider version: distribution packages differ. Thepkcs11-module-token-pin = file:directive works with the 0.x and 1.x providers. A 1.x provider built from source also supports apin-sourcefile attribute in individual URIs. Token PIN: a non-interactive provider consumer must supply the module login PIN. With a UserPass endpoint, the PIN is the endpoint password fromcryptohub.json. Store it in a file readable by the application service group:Replace<product>and<service-group>with the application directory and service group. Do not place apin-valuein the provider configuration or on a command line.
Select the provider configuration for your application
SetOPENSSL_CONF and CHLIBS_CONFIG in the environment of the process that loads the module, not merely an interactive shell. For a systemd-managed service, use a drop-in:
-
Create the drop-in directory and file (substitute your application’s systemd unit name):
-
Add the following. This sets
OPENSSL_CONFto the provider configuration andCHLIBS_CONFIGto the deployedcryptohub.json:The library resolves relative TLS authority paths incryptohub.jsonagainst the process working directory. SetWorkingDirectoryto the directory containing the CA files, or use absolute authority paths. -
Reload systemd so the drop-in takes effect:
pkcs11-module-token-pin = file:. Keep the pkcs11: URI free of pin-value; with a 1.x provider, pin-source is an alternative to the configuration directive, not an additional PIN source.
Confirm the provider loads
pkcs11 provider should appear as active in the output. If it is missing, re-check module and pkcs11-module-path in openssl-cryptohub.cnf.
