fxpkcs11.cfg file. This page covers the settings that most integrations need: the <HSM> section, which defines the connection to the HSM, and the logging settings in the <CONFIG> section. The config-reference.md file in the Futurex PKCS #11 package describes every setting.
By default, the library reads
C:\Program Files\Futurex\fxpkcs11\fxpkcs11.cfg on Windows and /etc/fxpkcs11.cfg on Linux. To use a different file, set the FXPKCS11_CFG environment variable to its full path.fxpkcs11.cfg file in a text editor as an administrator and edit it.
Configure the HSM connection
The following example connects to the HSM by using mutual TLS authentication with a PKCS #12 file:fxpkcs11.cfg
For server-side authentication, set
<PROD-TLS-ANONYMOUS> to YES and omit the <PROD-TLS-KEY>, <PROD-TLS-KEY-PASS>, <PROD-TLS-CERT>, and <PROD-TLS-CA> fields.
Protect passwords
Every password field (<CRYPTO-OPR-PASS>, <CRYPTO-OPR-PASS2>, and <PROD-TLS-KEY-PASS>) accepts the following forms:
- Environment variable:
env:followed by a variable name, such asenv:FXPKCS11_IDENTITY_PASS. The library reads the variable when it starts. If the variable isn’t set, the password is empty. - Windows registry (Windows only): the full path of a
REG_SZvalue, such asHKEY_LOCAL_MACHINE\Software\Futurex\fxpkcs11\Password. - Clear text: the password itself. Use it only for testing.
FXPKCS11_PASS and FXPKCS11_PASS2 environment variables. They override <CRYPTO-OPR-PASS> and <CRYPTO-OPR-PASS2> for every slot.
Configure logging
The<CONFIG> section at the top of the file controls logging. To troubleshoot a connection or a failed operation, set the following fields:
fxpkcs11.cfg
After you finish troubleshooting, set
<LOG-MODE> to ERROR or NONE.
Configure key usage
The HSM accepts only the key usage combinations allowed by its multi-usage settings. By default, it allows encrypt and decrypt, sign and verify, wrap and unwrap, and derive, each as a separate combination. If an application asks the library to create a key with a combination the HSM doesn’t allow, such as sign, verify, encrypt, and decrypt on one key, the HSM rejects it with the errorVALUE OUT OF RANGE. To fix it, use one of the following methods:
- Request an allowed combination in the application.
- If the application can’t do that, set a usage for all new keys with the
<FORCED-SYMMETRIC-USAGE>or<FORCED-ASYMMETRIC-USAGE>field in the<CONFIG>section, for example<FORCED-ASYMMETRIC-USAGE> SIGN | VERIFY </FORCED-ASYMMETRIC-USAGE>. - Allow the combination on the HSM. To view the allowed combinations, run the
multi-usage listFXCLI command. To add one, runmulti-usage add, for examplemulti-usage add --asymmetric --auth --encrypt --decrypt --sign --verify. Allowing more usages on a single key weakens key separation, so add only the combination that the application requires.
<GPED-EXPAND> to YES in the <CONFIG> section, it uses GPSE and GPSD instead. The application partition must allow whichever commands the library uses.
Configurations required for BIND integration
You must add the following lines to the<CONFIG> section of the fxpkcs11.cfg file to force sign and verify usage on generated keys and suppress non-critical error messages:
fxpkcs11.cfg
Verify the connection
1
Run
configTest from the fxpkcs11 directory. It connects to the HSM and prints the slot and token information:Shell
The output includes a Token Info section with the label Futurex and the serial number of the HSM.
2
Run In the menu, select 2. Login and enter the identity password, then select 8. Generate Random Data.
PKCS11Manager to test a login. Pass the configuration file path if it isn’t the default:Shell
The login succeeds and the HSM returns random data.
3
If either test fails, enable traffic logging as described in Configure logging, run the test again, and check the log file for
ERROR lines. For example, certificate verify failed means that the client doesn’t trust the HSM certificate, and Connection refused means that the address or port is wrong or that a firewall blocks the connection.
