A Crypto Worker is a Worker that performs no signing operations of its own. Its sole purpose is to host a Crypto Token, the component that provides access to keys and cryptographic operations, so that other Workers can reference it using the CRYPTOTOKEN property.
This page describes how the Crypto Token is configured within the Crypto Worker, and how to set up a Crypto Worker using the Admin Web or the REST Interface.
For conceptual background on Crypto Tokens, key aliases, and PKCS#11 objects, see Crypto Tokens: HSMs & Keystores.
Crypto Token Configuration
The Crypto Worker itself only requires the mandatory Worker properties. The actual configuration lives in the Crypto Token, defined by two things:
-
The Crypto Token implementation, set with the
CRYPTOTOKEN_IMPLEMENTATION_CLASSproperty. This determines whether keys are stored in an HSM or a software keystore. -
The implementation-specific properties, such as HSM slot details or the keystore path.
The following properties define the Worker and its Crypto Token:
|
Property |
Description |
|---|---|
|
|
Set to |
|
|
The Crypto Worker implementation: |
|
|
The Worker name. Other Workers reference the Crypto Token using this name in their |
|
|
The Crypto Token implementation, for example |
|
|
The key alias of a key used to test activation. Signers referencing this Crypto Token typically override this with their own key alias. |
PKCS#11 Crypto Token properties (HSM)
|
Property |
Description |
|---|---|
|
|
The name of the PKCS#11 shared library for your HSM, for example |
|
|
How the HSM slot is identified, for example |
|
|
The slot identifier value, for example |
|
|
The slot/partition PIN. If set, the Crypto Token is auto-activated. If omitted, the token must be activated manually. |
For all available properties, see PKCS#11 Crypto Token.
Keystore Crypto Token properties (soft keystore)
|
Property |
Description |
|---|---|
|
|
Path to the keystore file. Not used when From SignServer 7.6, ensure that the directory where the keystorepath is read from is on the allowlist. See Deploy-time Configuration. |
|
|
The keystore type: |
|
|
The keystore password. If set, the Crypto Token is auto-activated. |
For all available properties, see Keystore Crypto Token.
The following shows a complete example configuration for a Crypto Worker hosting a PKCS#11 Crypto Token:
WORKERGENID1.TYPE=CRYPTO_WORKER
WORKERGENID1.IMPLEMENTATION_CLASS=org.signserver.server.signers.CryptoWorker
WORKERGENID1.CRYPTOTOKEN_IMPLEMENTATION_CLASS=org.signserver.server.cryptotokens.PKCS11CryptoToken
# Name for other Workers to reference this Crypto Token:
WORKERGENID1.NAME=HSMCryptoToken1
# PKCS#11 shared library and HSM slot details:
WORKERGENID1.SHAREDLIBRARYNAME=Utimaco
WORKERGENID1.SLOTLABELTYPE=SLOT_NUMBER
WORKERGENID1.SLOTLABELVALUE=1
WORKERGENID1.PIN=foo123
# One key to test activation with is required. If this key does not
# already exist, generate it after the Worker has been created.
WORKERGENID1.DEFAULTKEY=testkey0
The WORKERGENID1 prefix is used when loading properties files via the Administration Web or Administration CLI, and instructs SignServer to generate a new Worker ID. When configuring via REST, the prefix is not used. Properties are provided as plain JSON key-value pairs.
Set Up a Crypto Worker Using the Administration Web
Using an HSM
To set up a Crypto Worker with a PKCS#11 Crypto Token, do the following:
-
Access the SignServer Admin Web.
-
On the Workers page, click Add and select From Template.
-
Select
pkcs11-crypto.propertiesand click Next. -
In the configuration text area, adjust the Crypto Token properties for your HSM:
-
NAME: Specify a name for the Worker, for exampleHSMCryptoToken1. -
SHAREDLIBRARYNAME: The PKCS#11 shared library name for your HSM. -
SLOTLABELTYPEandSLOTLABELVALUE: The slot identification for your HSM. -
DEFAULTKEY: The alias of an existing key, or the alias of a test key to generate in the next step.
-
-
Click Apply.
-
Select the new Worker in the Workers list and click the Status Summary tab to check for any errors.
-
Enter the slot/partition password (if required by the HSM/keystore) and click Activate.
-
Select the new Worker in the Workers list and click the Status Summary tab to check for any errors.
-
If the Crypto Token is not already activated, click Activate, enter the slot/partition password (if any), and click Activate. The Crypto Token must be activated before keys can be generated on it.
If the PIN property is set in the configuration, the Crypto Token is auto-activated and this step can be skipped.
-
If the
DEFAULTKEYkey does not yet exist, click the Crypto Token tab, select Generate Key, and specify the following:-
Key Alias: The same alias as configured in
DEFAULTKEY, for exampletestkey0. -
Key Algorithm: For example
RSA. -
Key Specification: For example
2048.
-
-
Click Generate.
-
Click the Status Summary tab and confirm that the Worker status and Token status are both ACTIVE.
If the Worker is not in the state ACTIVE, check for errors on the Status Summary tab and then in the server log if needed.
Using a Soft Keystore
To set up a Crypto Worker with a Keystore Crypto Token, do the following:
-
Access the SignServer Admin Web.
-
On the Workers page, click Add and select From Template.
-
Select
keystore-crypto.propertiesand click Next. -
In the configuration text area, adjust the Crypto Token properties:
-
NAME: Specify a name for the Worker, for exampleSoftCryptoToken1. -
KEYSTORETYPE:INTERNALto store the keystore in the SignServer database. -
KEYSTOREPATH: Clear this property since the internal keystore type is used.
-
-
Click Apply.
-
Select the new Worker in the Workers list and click the Status Summary tab to check for any errors.
-
Click Activate and specify a password, then click Activate. When using the internal keystore type, the password is set the first time the token is activated. The Crypto Token must be activated before keys can be generated on it.
-
Since the internal keystore starts out empty, generate the
DEFAULTKEYkey: click the Crypto Token tab, select Generate Key, and specify the following:-
New Key Alias: The same alias as configured in
DEFAULTKEY, for exampletestkey0. -
Key Algorithm: For example
RSA. -
Key Specification: For example
2048.
-
-
Click Generate.
-
Click Activate again and enter the keystore password.
The Crypto Worker should now be in state ACTIVE. If not, check for errors on the Status Summary tab.
A software keystore is suitable for testing and evaluation. For production signing deployments, use an HSM-backed Crypto Token.
Set Up a Crypto Worker Using REST
The SignServer REST Interface allows you to create and configure the Crypto Worker programmatically. For general information on the REST Interface, including authentication and the OpenAPI specification, see REST API Interface.
Administrative REST operations require:
-
A client TLS certificate for an authorized administrator, provided with the request.
-
The
X-Keyfactor-Requested-Withheader, which protects the endpoints against CSRF and clickjacking.
The following examples show the endpoints and request/response bodies independently of any specific HTTP client. For complete, ready-to-run examples with authentication included, see Admin REST Endpoints and Client REST Endpoints.
Step 1: Create the Crypto Worker
Send a POST request to the /workers endpoint with the Worker properties in the request body. Note that the properties are the same as in the properties file example above, but without the WORKERGENID1 prefix:
Request
POST /signserver/rest/v1/workers
Request Body
{
"properties": {
"TYPE": "CRYPTO_WORKER",
"IMPLEMENTATION_CLASS": "org.signserver.server.signers.CryptoWorker",
"CRYPTOTOKEN_IMPLEMENTATION_CLASS": "org.signserver.server.cryptotokens.PKCS11CryptoToken",
"NAME": "HSMCryptoToken1",
"SHAREDLIBRARYNAME": "Utimaco",
"SLOTLABELTYPE": "SLOT_NUMBER",
"SLOTLABELVALUE": "1",
"PIN": "foo123",
"DEFAULTKEY": "testkey0"
}
}
If the request is successful, SignServer returns status 201 Created and assigns a Worker ID. To create the Worker with a specific ID instead, send the request to POST /workers/{id}.
To use a soft keystore instead of an HSM, replace the Crypto Token properties accordingly:
{
"properties": {
"TYPE": "CRYPTO_WORKER",
"IMPLEMENTATION_CLASS": "org.signserver.server.signers.CryptoWorker",
"CRYPTOTOKEN_IMPLEMENTATION_CLASS": "org.signserver.server.cryptotokens.KeystoreCryptoToken",
"NAME": "SoftCryptoToken1",
"KEYSTORETYPE": "INTERNAL",
"DEFAULTKEY": "testkey0"
}
}
Step 2: Verify Configuration
Send a GET request to /workers/{id} to confirm the Worker configuration:
Request
GET /signserver/rest/v1/workers/100
The response contains the full set of configured Worker properties.
Step 3: Update Properties
To change or add individual Crypto Token properties without affecting the rest of the configuration, send a PATCH request to /workers/{id}.
Request
PATCH /signserver/rest/v1/workers/100
Request Body
The body only needs to contain the properties to add or change:
{
"properties": {
"SLOTLABELVALUE": "2"
}
}
Response
{
"responseMessage": "Worker properties successfully updated"
}
Step 4: Reload the Worker
Configuration changes become active after a reload. Send a POST request to /workers/reload with the Worker ID in the request body:
Request
POST /signserver/rest/v1/workers/reload
Request Body
{
"workerIDs": [ 100 ]
}
If the request body is left empty, all Workers are reloaded.
Response
{
"responseMessage": "All requested workers successfully reloaded"
}
Key generation and manual Crypto Token activation are not available through the REST Interface. Generate the DEFAULTKEY key and activate the token using the Administration Web or the Administration CLI. When the PIN (HSM) or KEYSTOREPASSWORD (keystore) property is set in the configuration, the Crypto Token is auto-activated and no manual activation is needed.
Next Steps
With the Crypto Worker in state ACTIVE, other Workers can now use its Crypto Token by referencing the Worker name:
CRYPTOTOKEN=HSMCryptoToken1
For guidance on where to install signing certificates and how key aliases are resolved on the token, see Crypto Tokens: HSMs & Keystores.