Using a hardware security module with X-Road

Regulated teams that must keep X-Road signing and authentication keys in hardware need to know what the hwtokens add-on covers, which key types work, and how backups and clusters change. This page covers the decision and the setup sequence.

On this page

Using a hardware security module with X-Road: when a key policy requires hardware

If a security policy or an auditor requires that private keys be held in hardware, X-Road can meet that requirement through a hardware security module (HSM) reached over PKCS#11. X-Road supports this through PKCS#11 drivers installed with the xroad-addon-hwtokens package, and it works with both RSA and EC keys. The Security Server is the component that uses these keys to sign messages and authenticate exchanges, so the HSM integration is configured on each Security Server that holds keys. For the team, the question shifts from whether X-Road can use hardware to which keys move into the device, on which servers, and how those servers are operated afterward.

Teams usually need this path when hardware-protected keys are a stated requirement, for example in an internal control, a supervisory expectation, or a customer's security questionnaire. The answer has to show that private keys are not stored as ordinary files that can be copied from the server. Ask the policy owner to state the requirement in writing: whether it covers authentication keys, signing keys or both, and whether it names a specific device standard. Those answers set the scope before any hardware is bought. Confirm the supported device models and PKCS#11 driver versions for your Security Server release in the X-Road Security Server installation guide, because this page does not list them.

Plan the rest of the work around what changes once keys sit in a device. Installation and key registration happen on the Security Server, so confirm in the installation guide what the driver, the token and its access credentials require on every server that performs signing or authentication. Decide early who holds the token credentials and how that access is separated from the Security Officer and System Administrator roles in the Security Server. Then test key generation or import on a non-production server, and check how the token behaves after a restart before the policy evidence is collected. Backup, clustering and recovery of HSM-held keys carry their own constraints, so review them before you commit to a design.

Signing and authentication requests reach HSM keys through one driver

The diagram starts at the Security Server inside the customer's data center, which is the trust boundary. The admin UI configures the hardware token for the Security Server, and the Central Server, which sits outside that boundary, sends global configuration to the Security Server. When the Security Server needs a signature or must authenticate a TLS connection, it calls the PKCS#11 driver from the hwtokens add-on, and the driver passes the key operation to the HSM. Check that key generation and every signing and authentication operation run on the HSM, that the private key should stay on the device, and that the driver and HSM are covered by your backup and recovery plan.

Signing and authentication requests reach HSM keys through the PKCS#11 driver.

Choosing key storage and layout for X-Road keys

This table compares key storage and server layout options for X-Road authentication and signing keys, and shows how each choice changes day-to-day operations. Read each row as a decision: check when the option fits, what it changes for your team, and what to confirm with your HSM vendor and the X-Road documentation before you commit. Key storage and server layout interact, so review the rows together.

OptionWhen it fitsWhat changes for operationsWhat to confirm
Software-held keys on the Security ServerDeployments where your security policy does not require key material to stay in dedicated hardwareKey material sits on the server, so backup and restore procedures must protect the keys as well as the configurationHow key material is stored and protected in backups for your X-Road release
PKCS#11 HSM storageYour policy requires key material to stay in dedicated hardwareSigning calls go through the PKCS#11 driver, so the module, token login and slot setup become part of each deploymentSupported HSM models, driver versions and the hardware token add-on package for your release
RSA keysYour members, Central Server and information systems already work with RSA keys and your team has established procedures for themFamiliar certificate and key workflows; test HSM key generation and signing with RSA before going liveKey lengths your HSM supports, and whether peer Security Servers in the ecosystem accept the key lengths you choose
EC keysYour X-Road release and ecosystem peers support EC keys, and your HSM supports the curves you needDifferent key generation and certificate request steps; the HSM must generate or import EC keys correctlySupported curves on your HSM, and EC support on every Security Server and Central Server that interacts with yours
Single Security ServerPilots, or members whose availability expectations a single server can meetOne key store and one PKCS#11 configuration to maintain; an outage of the server stops message exchange until it is restoredRecovery time from backup, and whether the HSM can be replaced or restored without rebuilding the server
Clustered Security Servers behind a load balancerAvailability requirements that one server cannot meet, with several nodes able to serve exchangesEach node must reach the HSM and hold matching key configuration, so HSM provisioning and token login are repeated per nodeHow the cluster distributes keys, and whether HSM tokens and login must be configured on every node

Setting up a hardware security module for X-Road signing keys

This sequence places X-Road signing and authentication keys on a hardware security module that the Security Server reaches through PKCS#11. Each step ends with a check you can run, so a fault shows up on the Security Server before any certificate is registered. The result is a Security Server whose keys sit on the token, with certificates that match the key types you chose.

  1. Confirm platform and X-Road version support

    Check that the Security Server runs on a supported operating system and X-Road version before you configure anything. The supported platforms are Ubuntu Server 22.04 and 24.04 LTS on x86-64 and Red Hat Enterprise Linux 8 and 9, and the supported X-Road versions are 7.8.3, 7.7.4 and 7.6.5. Ask the HSM vendor in writing whether its PKCS#11 library supports that operating system and release, and whether it supports the RSA, EC or both key types you plan to use. This step is done when the vendor confirms compatibility in writing and your server's operating system and X-Road version appear on the supported lists.

  2. Install the xroad-addon-hwtokens package

    On the Security Server, install the xroad-addon-hwtokens package from the package source you use for your X-Road release. This package lets the Security Server load hardware tokens through PKCS#11 drivers. Run the installation in a test environment first, then in production during a maintenance window agreed with your change process. Confirm that your package manager reports the package as installed, that its version matches the X-Road release on the server, and that the Security Server still starts and opens its admin UI on TCP 4000.

  3. Load the vendor PKCS#11 library

    Install the HSM vendor's PKCS#11 library on the Security Server, using the file location and steps the vendor documents, and make it available to the hardware token add-on. Your HSM team or the vendor usually supplies the client software and drivers. Restrict read access to the library file to the service account that needs it. Confirm that the library loads without errors and that the HSM slot or partition is visible to the Security Server. If the library loads but the slot is missing, check network reachability to a network-attached HSM and the partition assignment with the HSM administrator before continuing.

  4. Configure token login and PIN handling

    Decide who holds the token PIN or password, how it is entered after a restart, and which Security Server role performs token login. The user guide defines several roles, including Security Officer and System Administrator, so confirm in the user guide which role manages tokens in your version before you assign access. Do not store the PIN in configuration files, scripts or shell history. Write down the re-login procedure for reboots and failover. This step is done when the token appears in the Security Server's token list in the admin UI as available and logged in, and a restart brings the token back through the documented procedure.

  5. Create or import signing and authentication keys

    Create the authentication and signing keys on the token, or import keys generated under your key ceremony. Choose RSA or EC so that the key type matches the certificate profile your certification authority requires. Compare the key type on the token with the certificate request before you submit it, because a mismatch means the request has to be redone. Confirm that each key appears under the token in the admin UI with the expected algorithm and length. If your HSM policy requires keys that cannot be exported, confirm that the vendor setting is applied, then record the key labels for the certificate step.

  6. Request and register the certificates

    Generate a certificate request for each key on the token, submit it to your approved certification authority, and import the issued certificates into the Security Server against the matching key label. Register the authentication certificate and activate the signing certificate as your operator process requires. Confirm that each certificate lists the key label you recorded earlier and that its public key type matches the key on the token. Finish with a test message exchange with a test member or in your operator's test environment, and check that the exchange succeeds and appears in the message log.

What changes for backups, restores and clustering

Moving keys into an HSM changes what you back up, how you restore and what every node must reach. The four cards cover the database and configuration, the key material, recovery onto new hardware and clustered device access. Confirm the exact HSM backup and restore procedure with the HSM vendor and the X-Road backup guidance before you rely on it.

Security Server database and configuration

The Security Server keeps its operational state in PostgreSQL, which can run locally or as a managed service such as AWS RDS or Azure Database for PostgreSQL. Back up the database and the server configuration together, so that the Security Server's records agree with the keys the HSM holds at the same point in time. Check that both are captured in one restore point and that a restore has been tested on a separate host. Confirm the backup scope with your PostgreSQL service's documentation and the X-Road backup guidance.

Security Server installation guide

Key material held in the HSM

Signing and authentication keys stay in the HSM and are reached through a PKCS#11 driver from the xroad-addon-hwtokens package, for both RSA and EC keys. Whether those keys can be backed up, exported in wrapped form or replicated to a second device depends on the HSM model and how it is configured. Treat the HSM backup method as a design decision made before go-live, and get the exact procedure in writing from the vendor. Do not assume that a copy of the database alone recovers the keys.

Restore onto new nodes or HSMs

A replacement Security Server needs the database and configuration restored, the same xroad-addon-hwtokens package and a PKCS#11 driver version your HSM vendor supports, and access to the restored keys. A replacement HSM must present the keys under the token configuration the server expects, so record slot and token labels in your runbook before an incident. Rehearse the full restore in a separate environment and measure how long it takes against your recovery objectives. Write each step down so the team can repeat it without the engineers who built the setup.

Device access on every cluster node

In a clustered Security Server setup, each node that signs or authenticates messages must reach the HSM through its own PKCS#11 driver configuration. A network-attached device needs network routes and credentials from every node, and a locally attached device must be installed and configured on each host. Test failover with one node's device path removed and confirm that each remaining node still signs and authenticates. Check that every node sees the same keys before you rely on the cluster.

RSA and EC keys in hardware: trade-offs before you choose

The X-Road hardware token add-on supports both RSA and EC keys, so the first decision is which key type your signing and authentication keys will use before any certificate is requested. Make that choice before the HSM is configured, because the key type sets the certificate request, the certificate profile your certification authority must accept, and what other members' Security Servers need to verify. Ask your certification authority whether it issues certificates for the chosen key type and which profile applies. Record the answer in the change record so that the key generation, the certificate request, the registration and every later renewal use the same algorithm. A mismatch discovered at registration usually means generating a new key and submitting a new request, which costs time on both sides.

Compatibility is the decision you cannot settle alone. Your key type affects whether the Security Servers of the members you exchange data with can verify your certificates and check your signatures. Read the separate topic on moving X-Road to EC keys for the ecosystem compatibility rules, and ask your X-Road operator which key types are in use across the instance before you commit. Do not assume that the rules for your own server apply to every member. HSM support is the second gate: confirm that your HSM model supports the key type and key size you plan to use through its PKCS#11 driver, because the add-on can only use what the device and driver expose. Also check that the driver works with the xroad-addon-hwtokens package on your operating system, using the Security Server installation guide as the reference for supported platforms and the hardware token setup.

Before you configure production, run a short proof on a non-production Security Server. Generate one key of each type you are considering inside the HSM through the PKCS#11 driver, create a certificate request from each, and confirm that signing works end to end with the test configuration. Keep the results with the change record. Security Server platforms in the supported set are Ubuntu Server 22.04 and 24.04 LTS on x86-64 and Red Hat Enterprise Linux 8 and 9, so run the proof on the same operating system and driver version you plan to use in production. Ask your HSM vendor to confirm in writing which key types and mechanisms the device supports on that exact combination, and bring that confirmation into the design review before the production build starts.

Security controls around HSM-held keys

Four controls connect the HSM to the people and accounts that can use it. Each one limits who can reach the keys, how the token is unlocked, and how administrators prove who they are. The X-Road documents cover the software side, so confirm the device settings, such as PIN policy and device access, with your hardware vendor.

Separate Security Officer and admin duties

The Security Server defines five user roles. For HSM-held keys, the two that matter most are the Security Officer and the System Administrator, which should be held by different people. Assign them to separate named individuals so that one operator cannot change both the host and the key configuration alone. Check the user guide for the actions each role can perform in your version, and test that each role can do only its own work.

User guide

Control token PIN and credentials

HSM keys are reached through a PKCS#11 driver installed with the xroad-addon-hwtokens package, and the token PIN is what unlocks the keys for the Security Server. Record who knows the PIN, where it is stored and how it is changed, and keep it out of configuration files, shell history and tickets. Confirm with your HSM vendor the PIN retry limit, the behavior after failed attempts, and whether the PIN can be changed on the device without reinitializing it.

Installation guide

Admin access through PAM and SSSD

Admin users authenticate through PAM, and PAM can use SSSD to reach LDAP. X-Road roles are matched to LDAP groups, so the group mapping decides who holds each role. Decide the mapping before go-live and test it with one account per role. Also confirm that removing a user from a group ends access to the admin UI and to the host itself, since SSH may be configured separately from PAM.

User guide

Account lockout and key-only SSH

The X-Road security hardening guide (version 0.6, 09.01.2025) recommends locking accounts for 15 minutes after 3 failed logins and using passwords of at least 16 characters. It also recommends key-only SSH and the allowed-hostnames setting against host header injection. Apply these to the Security Server and any jump host, then confirm that lockout cannot shut out the only System Administrator during an incident, and keep a tested break-glass path.

Hardening guide

How much does an X-Road HSM setup cost, and what must your team provide?

What drives the cost of an X-Road HSM setup?

The main cost drivers are the HSM hardware and its vendor support, the engineering labor to integrate it, and the testing and documentation that show it works. You buy the hardware and support from the HSM vendor, and those charges can be a mix of one-time and recurring items. Labor is paid to whoever builds the setup, whether your staff or a partner, and it is usually one-time for each environment. Costs rise with the number of Security Servers, the key types in use (RSA, EC or both), the number of HSM models you must validate, and the need for a backup and restore procedure your auditors can review. Ask any quote to separate hardware, licenses, labor, testing and recurring support, and to name the environments it covers.

Can our own team set up X-Road with an HSM alone?

Yes, if your team already runs Linux servers, PostgreSQL and X-Road Security Servers, and can work with your HSM vendor's PKCS#11 library. X-Road supports hardware security modules through PKCS#11 drivers using the xroad-addon-hwtokens package, with RSA and EC keys. The package install is usually the easy part. The harder work is the vendor tooling: creating token partitions, loading the library on each host, measuring signing behavior, and rehearsing a restore. Your team should also own the key ceremony, certificate registration and the failover test. Teams without HSM experience often underestimate vendor documentation and firmware compatibility checks. Confirm your skills against the Security Server installation guide before you decide. A partner helps when that experience is missing or when the work must finish inside a fixed window.

What makes an X-Road HSM project take longer?

The main timeline drivers are HSM procurement, the number of Security Servers, and how many change windows you need. Hardware lead time depends on your vendor and procurement process, so confirm delivery dates before you schedule anything. Compatibility testing takes time when the vendor PKCS#11 library must be checked against the X-Road release you run. The current supported releases are 7.8.3, 7.7.4 and 7.6.5, so confirm which one your ecosystem uses before you choose a library version. Moving existing keys from software storage into an HSM adds a planned cutover, and that cutover depends on certificate renewal timing. Each Security Server needs its own install, token setup and verification, so the server count matters. Approvals from your change board and from the operator of your Central Server can add waiting time. Ask for a schedule that lists the dependencies, not only the end date.

Which HSM access and change windows will the work need from us?

The work cannot proceed without a few items from your side. The main items are:

  • HSM access: network reachability from each Security Server host to the HSM, the vendor client software or PKCS#11 library, and an administrator account that can create token partitions and users.
  • Hosts: Linux servers that meet the Security Server requirements, including Ubuntu Server 22.04 or 24.04 LTS or Red Hat Enterprise Linux 8 or 9, at least 3 GB RAM (4 GB with monitoring add-ons), 3 GB free disk space, and a PostgreSQL database, local or remote.
  • Change windows: planned restarts and cutovers approved in advance, with a rollback plan for each.
  • Decisions: who holds the key ceremony, who approves certificate registration, and which key types you will use.

Agree these items in the scope before work starts, because a missing HSM account or closed change window can stop the work for days.

How does clustering change the effort for X-Road HSM keys?

Clustering adds effort mainly in consistency and failover testing. Every clustered Security Server must reach the HSM and use the same key configuration, so each node needs its own token setup verified rather than assumed to match. Backup planning changes too. Keys held in an HSM often cannot be exported like a file, so recovery depends on the vendor's HSM backup procedure and on how you rebuild a failed node. Plan a load balancer test, a node failure test and a restore test, and confirm the design against the high availability guidance for your release. Each extra node multiplies verification, change windows and documentation. Check network latency between the nodes and the HSM as well, because key operations happen during message exchange and slow or unavailable devices can affect service.

What should a fixed-scope quote for HSM work include?

A fixed-scope quote should describe the work in terms you can check against the delivered system. DeployOpen agrees scope, deliverables and timelines in writing before work starts, and a quote follows from that written scope. Ask for the HSM model, vendor library version and X-Road release, the number of Security Servers and whether they are clustered, and the key types in scope. Also ask for the verification steps, including a restore test, the runbook and documentation you will receive, and who attends the change windows. Acceptance criteria and a retest after fixes should be written in as well. Ask what is excluded, such as HSM hardware, vendor support contracts, Central Server work or ongoing operations. Ongoing support, upgrades and continuous testing can be quoted separately as a retainer. DeployOpen does not publish a price list, so the written scope is the basis for the quote.

Limits to confirm in your environment

Each limit below changes what you can build, so settle them before you order hardware or write a deployment plan. The cards cover device and driver support, release compatibility, the X-Road 8 timeline, and key type and clustering fit. Confirm every point with your HSM vendor and the official X-Road documentation, because support depends on the exact model, library and release you run.

HSM models and PKCS#11 libraries

X-Road reaches hardware security modules through PKCS#11 drivers, using the xroad-addon-hwtokens package on the Security Server. Confirm the exact model and library pair first. Ask the vendor which PKCS#11 library version they certify for your device, whether that version works with the add-on package you will install, and which firmware was used in testing. Get the answer in writing from the vendor, and check it against the official installation documentation before procurement. Treat any untested pair as a proof of concept to run before production.

Installation guide

Compatibility across release lines

The supported X-Road releases are 7.8.3, 7.7.4 and 7.6.5, and 7.8.3 is the current release. Test the add-on on every release line you run. If your Security Servers sit on different releases, for example during a staggered upgrade, each node needs a working HSM setup for its own release. Confirm whether the library version must match across nodes. Record the add-on package version and the PKCS#11 library version on each server, and ask the vendor whether it has tested the library against all three lines, not only the newest one.

X-Road releases

Status of X-Road 8

X-Road 8 Spaceship is available for testing as 8.0.0 Beta 2, and its production release is scheduled for December 2026. X-Road 7.8.0 is the last new-feature release of the 7 line. NIIS intends to keep maintaining X-Road 7 with bug fixes and security patches beyond 2026, but the length of that period has not been decided. Do not assume your HSM setup carries over to X-Road 8. Ask whether the add-on and your device are planned for version 8, and run a test on the beta if your HSM decision must outlast X-Road 7 support.

NIIS blog post

Key types and clustering fit

X-Road signing and authentication keys can be RSA or EC, so check that your device holds the key type you plan to use and that the library exposes it. Map the clustering pattern before you buy. Decide whether each Security Server node will reach its own token, a shared network appliance, or a partition shared across nodes. Then ask the vendor whether concurrent sessions from several nodes are supported and how key objects are replicated. Ask how backup and restore of key objects works on your device, because it shapes your recovery plan.

How DeployOpen scopes and delivers HSM integration for X-Road

DeployOpen plans and delivers hardware security module integration for X-Road inside your own infrastructure, so signing and authentication keys can sit on a PKCS#11 device you control. Each engagement is fixed-scope, with scope, deliverables and timelines agreed in writing before work starts. The work covers the hardware token add-on on your Security Servers, the key types you choose, and the operational changes for backups and clustering.

How we scope

  • The written scope names each Security Server and the HSM model, driver and PKCS#11 library in use.
  • We confirm which key types, RSA or EC, each signing and authentication key will use before build.
  • Scope also covers backup, restore and cluster changes, and which of them your team or ours will run.

How we build

  • Install the xroad-addon-hwtokens package on each Security Server and confirm the PKCS#11 module loads.
  • Configure the token and key references, then test signing and authentication against a non-production member.
  • Record each device setting, library path and key label so the configuration can be rebuilt on a new host.

How we hand over

  • A runbook covering device configuration, key inventory and recovery steps when the HSM is unavailable.
  • Test evidence for each step, including the backup and restore checks agreed in the scope.
  • Knowledge transfer to your operations staff, with a walkthrough of the key lifecycle you will run.

How we support

  • Ongoing support, upgrades and continuous testing are available as a retainer after handover.
  • Before any X-Road upgrade, confirm the HSM driver and PKCS#11 module remain supported for your version.
  • Ask the HSM vendor to confirm firmware and library compatibility before any change on the device.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.