Skip to main content
The Futurex CNG provider reads its settings from the fxcng.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 CNG package describes every setting.
By default, the provider reads C:\Program Files\Futurex\fxcng\fxcng.cfg. To use a different file, set the FXPKCS11_CFG system environment variable to its full path. Futurex CNG shares its configuration parser with the Futurex PKCS #11 library, so it doesn’t read an FXCNG_CFG variable.
Open the fxcng.cfg file in a text editor as an administrator and edit it. The provider reads the file each time a process loads it, so you don’t need to run CNGInstallUtil again after a change. Restart long-running applications and services so that they load the new settings.

Configure the HSM connection

The following example connects to the HSM by using mutual TLS authentication with a client certificate in the Windows certificate store (Option 1 in Configure TLS authentication):
fxcng.cfg
Comments in fxcng.cfg must start with #. The provider doesn’t support XML comments (<!-- -->); a single XML comment stops it from reading the rest of the section.
For a client certificate in a PKCS #12 file (Option 2), replace the four Windows certificate store lines with the following fields:
fxcng.cfg
For server-side authentication, set <PROD-TLS-ANONYMOUS> to YES and omit the <PROD-TLS-ENGINE>, <PROD-TLS-WIN-STORE>, <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 as env:FXCNG_IDENTITY_PASS. The provider runs inside the application’s process and reads the variable from that process’s environment, so set it as a system variable and restart the application or service.
  • Windows registry: the full path of a REG_SZ value, such as HKEY_LOCAL_MACHINE\Software\Futurex\fxcng\Password. Restrict the key’s permissions to administrators and the account that runs the application.
  • Clear text: the password itself. Use it only for testing, and restrict who can read fxcng.cfg.
You can also set the FXPKCS11_PASS and FXPKCS11_PASS2 system 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. The provider writes its log to the <LOG-FILE> path. The default path in the package’s fxcng.cfg is /tmp/fxpkcs11.log, which Windows resolves to C:\tmp\fxpkcs11.log; if the provider can’t write there, it uses a file in the user’s temporary folder. Set a directory that the account running the application can write to:
fxcng.cfg
To troubleshoot a connection or a failed operation, set <LOG-MODE> to DEBUG and <LOG-TRAFFIC> to YES, reproduce the problem, and check the log file for ERROR lines. After you finish troubleshooting, set them back.

Verify the provider

Confirm that Windows loads the provider and that it logs in to the HSM, as described in Verify the provider. If the test fails, check the log file:
  • certificate verify failed: the provider doesn’t trust the HSM certificate. Check <PROD-TLS-CA>.
  • Error reading message. 0 bytes thrown away right after the connection is established: the HSM requires a client certificate and the provider didn’t send one. Check <PROD-TLS-ANONYMOUS> and the client certificate fields.
  • Failed to add PKCS12 private key: the PKCS #12 password is wrong or empty in the application’s process. Check <PROD-TLS-KEY-PASS> and that the environment variable is set system-wide.
  • Failed to establish connection or Unable to connect to destination: the address or port is wrong, or a firewall blocks the connection.