Skip to main content
The Futurex EKM library reads its settings from the fxekm.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 EKM package describes every setting.
By default, the library reads C:\Program Files\Futurex\fxekm\fxekm.cfg. To use a different file, set the FXPKCS11_CFG system environment variable to its full path and restart SQL Server. Futurex EKM shares its configuration parser with the Futurex PKCS #11 library, so it doesn’t read an FXEKM_CFG variable.
Open the fxekm.cfg file in a text editor as an administrator and edit it. SQL Server loads the library once, when the service starts or when you register the provider, so restart the SQL Server service after you change the file.

Configure the HSM connection

The following example connects to the HSM by using mutual TLS authentication with a client key in a PKCS #12 file (see Configure TLS authentication):
fxekm.cfg
Comments in fxekm.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 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 (<PROD-TLS-KEY-PASS>, and <CRYPTO-OPR-PASS> if you set it) accepts the following forms:
  • Environment variable: env: followed by a variable name, such as env:FXEKM_IDENTITY_PASS. The library runs inside the SQL Server process and reads the variable from that process’s environment, so set it as a system variable and restart SQL Server.
  • Windows registry: the full path of a REG_SZ value, such as HKEY_LOCAL_MACHINE\Software\Futurex\fxekm\Password. Restrict the key’s permissions to administrators and the SQL Server service account.
  • Clear text: the password itself. Use it only for testing, and restrict who can read fxekm.cfg.

Configure logging

The <CONFIG> section at the top of the file controls logging. The library writes its log to the <LOG-FILE> path. The default path in the package’s fxekm.cfg is /tmp/fxpkcs11.log, which Windows resolves to C:\tmp\fxpkcs11.log; if the library can’t write there, it uses a file in the service account’s temporary folder. Set a directory that the SQL Server service account (NT Service\MSSQLSERVER for the default instance) can write to:
fxekm.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 connection

After you register the provider and create the asymmetric key in SQL Server (Configure EKM on the SQL Server and Enable TDE on SQL Server by using EKM), check the log file for ERROR lines if a step fails:
  • certificate verify failed: the library doesn’t trust the HSM certificate. Check <PROD-TLS-CA> or the CA in the PKCS #12 file.
  • Error reading message. 0 bytes thrown away right after the connection is established: the HSM requires a client certificate and the library didn’t send one. Check <PROD-TLS-ANONYMOUS> and <PROD-TLS-KEY>.
  • Failed to add PKCS12 private key: the PKCS #12 password is wrong, or empty in the SQL Server process.
  • Failed to establish connection or Unable to connect to destination: the address or port is wrong, or a firewall blocks the connection.
  • No log file at all: SQL Server didn’t load the library. Check the SQL Server error log for Failed to verify Authenticode signature on DLL, as described in Install Futurex EKM (FXEKM) and FXCLI.