Configuring the Utimaco CNG Provider
A CSP (Cryptographic Service Provider) is a general-purpose cryptography standard developed by Microsoft. It defines a cryptographic interface for applications (CryptoAPI) and an interface for manufacturers to integrate their cryptographic hardware.
A CNG (Cryptography API Next Generation) is Microsoft's second-generation cryptographic interface. It offers updated cryptographic algorithms and is intended to replace CSP in the long term.
When installing the SecurityServer setup, make sure to select the CSP/CNG - Cryptographic Service Provider (Microsoft) interface. A Cryptographic User should be created. An MBK is recommended for backup and recovery purposes.
Verifying the HSM Device Connection
Before configuring the HSM users and the CNG provider, verify that the device is configured and reachable from the Windows Server. Open the CryptoServer Administration Tool, select the configured device, and click Test.
Verifying the CryptoServer device connection
A successful connection confirms that the configured device is reachable. Click OK to continue.
Creating HSM Users
Start the CryptoServer Administration Tool and log in as a user with the permission level of at least 02000000.
Logging in to the CryptoServer Administration Tool
Creating a Cryptographic User
Crypto Users with a permission level of 00000002 will have to be created. Use encrypted passwords. For this guide, a user with a permission level of 00000002, CXI Group "CNG", and HMAC password will be created.
Creating a Crypto User
If the Key Manager and Cryptographic User roles are separated, a Key Manager user may need to be created.
Based on your requirement, the user can use password (HMAC), smartcard, or keyfile protection type. If you are using smartcard authentication, the prompt will go on the PIN Pad device to insert the smartcard and enter the pin. Then press OK button on the PIN Pad.
Setting up the CSP/CNG Provider
The CS_CNG_CFG environment variable specifies the path and name of the CNG configuration file. By default, it is located at C:\ProgramData\Utimaco\CNG\cs_cng.cfg.
Open the cs_cng.cfg file with an appropriate text editor. For PowerShell, use the following command:
notepad C:\ProgramData\Utimaco\CNG\cs_cng.cfg
Update the following parameters in the cs_cng.cfg file according to the target environment: logging configuration, user authentication, CXI group, and device address. Configure the Login parameter according to the authentication method used, such as HMAC password, KeyFile, or smartcard.
# Path to the logfile (name of logfile is attached by the API)
Logpath = C:\ProgramData\Utimaco\CNG\log
# Loglevel (0 = NONE; 1 = ERROR; 2 = WARNING; 3 = INFO; 4 = TRACE)
Logging = 0
# Maximum size of the logfile in bytes
Logsize = 8mb
# Keys are stored in an external or internal database
KeysExternal = false
# Path to the external keystore. Directory must be given, not file!
KeyStore = C:\ProgramData\Utimaco\CNG\keys
# Export policy for newly created keys: 0=allow all, 1=deny plain export (standard), 2=deny all
ExportPolicy = 1
# Prevents expiring session after inactivity of 15 minutes
KeepAlive = true
# Timeout of the open connection command in ms
ConnectionTimeout = 3000
# Timeout of command execution in ms
CommandTimeout = 60000
# CXI group for all keys. The user has to have access to this group.
Group = CNG
# Auto-login for CNG provider. This should be used for automated server (re)start.
# If not present, a login dialog will appear.
# Use ANSI encoding (instead of UTF-8) for this file in case special characters are used in passwords.
# The following login mechanisms are supported:
# HMAC password:
# Login = username,password
# optionally, the login mechanism can also be given:
# Login = username,HMACPwd=password
# RSA Signature with keyfile (and optional pwd for file):
# Login = username,RSASign=filename#password
# RSA Signature with smartcard connected to the host (and optional PIN for automatic login):
# Login = username,RSASign=key-specifier#password
# RSA Signature with smartcard directly connected to the CryptoServer (and optional PIN for automatic login):
# Login = username,RSASC=key-specifier#password
# ECDSA Signature with keyfile (and optional pwd for file):
# Login = username,ECDSA=filename#password
# ECDSA Signature with smartcard connected to the host (and optional PIN for automatic login):
# Login = username,ECDSA=key-specifier#password
# For encrypted HMAC or key file passwords, use the syntax from the following examples:
# Login = username,HMACPwdEnc=<encrypted password>
# Login = username,RSASignEnc=filename#<encrypted password>
# default device and fallback devices
Device = <port@device_ip>
For more information regarding the commands and command parameters, please check the Utimaco documentation. The device may be a u.trust GP HSM PCIe or LAN device. The device line will follow one of these patterns, based on the HSM form factor:
Device = 288@ Hardware (LAN) HSM
OR
Device = /dev/cs2.0 Hardware (PCIe) HSM
Checking the CNG Configuration
After configuring the CNG provider, verify the connection to the device and confirm the configured provider, device, CXI group, and key storage mode.
cngtool listkeys
A successful connection displays the configured SecurityServer provider, device, CXI group, and key storage mode.