Encrypting the X-Road message log and archives

Encrypting message bodies in the X-Road message log database and in archive files is as much a key custody decision as a configuration change. Plan the keys, their backups and their recovery before enabling it.

On this page

When to encrypt the X-Road message log and archives

Encryption covers the message bodies stored in the message log database and the signed archive files produced from that log. Turning it on moves the main risk to key custody and backups: the database and archive copies are only as protected as the keys that open them, and those keys must be restorable after a failure without being copied to places your team does not control. Decide before go-live, because the message log is written continuously and the team needs to know whether existing rows and archives are affected if encryption is enabled later. Confirm that behavior before planning the change window, and treat key location and backup scope as part of the same decision.

Teams usually need body encryption when logged payloads contain personal, health, financial or other regulated data, or when a duty requires limiting who can read logged content, including database administrators and backup operators. In those cases the message log is no longer only an audit trail. It becomes a store of sensitive data that needs controls comparable to the systems the exchanged data came from. Metadata logging may be enough when the evidential need is to show that an exchange happened, between which members and at what time, and the business does not need the content kept. Make that choice per Security Server or subsystem, and read X-Road full logging vs metadata logging before deciding, because switching modes changes what evidence exists for each exchange.

Confirm the exact switches, parameter names and steps in the Security Server user guide for your version, which is 7.8.3, 7.7.4 or 7.6.5, because this page does not give them. Before a test run, confirm where the encryption keys are stored, whether a hardware security module can hold them, how they are included in backups, and how a restore recovers them together with the database and archives. Record who holds key access and who approves a restore, then test a restore on a non-production Security Server before relying on the setup.

Options for body encryption, archive encryption and key storage

This table compares the main decisions for encrypting the message log and archives: message bodies in the database, signed archive files, where keys are held and the database platform underneath. Read each row as an independent choice, since none of these options is a default and they can be combined. The main takeaway is that every option moves key custody and backup responsibility somewhere specific, so confirm those points before you enable anything.

OptionWhat it protectsWhen it fitsWhat to confirm
Message body encryption in the message log databaseLogged message payloads stored in PostgreSQL, so raw bodies are unreadable to anyone with only database access.Organizations that must keep full logged bodies but need to limit who can read them in the database.How evidence queries, database dumps and restores behave with encrypted bodies, and who holds the key.
Archive encryption for signed archive filesSigned archive files while they sit outside the Security Server, such as in long-term storage.Archives leave the Security Server for long-term retention and must stay confidential in storage and transit.Which key encrypts the archives and how the archive transfer tooling handles encrypted files.
Software-held keys on the Security ServerKeys held in software on the host, so protection depends on host access and backup controls.Teams that want the simplest operation and accept host-level protection for signing and encryption keys.Who can read key material on the host, and whether key backups are encrypted and access-controlled.
Hardware security module through PKCS#11Private keys kept inside a hardware security module, accessed through PKCS#11 with the xroad-addon-hwtokens package.Keys must stay inside an HSM under policy. Documented support covers RSA and EC keys.That the documented support applies to message log encryption keys, and how the HSM is backed up and failed over.
Remote or managed PostgreSQL databaseDatabase storage and access at the database layer, separate from X-Road body encryption.Message log on a separate server or managed service such as AWS RDS or Azure Database for PostgreSQL.How database-level encryption and cloud key services combine with X-Road body encryption, and who manages the keys.

How the message log database, archive files and keys connect

The flow starts with an information system and consumer sending requests through the Security Server, inside the host boundary. Message bodies pass through body encryption before log rows reach PostgreSQL, which may run locally or on a remote server. The archive job reads the message log and produces signed archive files, which archive encryption then protects. The key store, either software or a PKCS#11 HSM, supplies keys to both encryption steps from inside the key custody boundary. Encrypted backups go to a restore target on a separate host, and the key backup is held under different custody. Check that keys and backups can be restored together. Confirm the exact flow against the user guide for your installed version.

Conceptual view of message log encryption, archive files, keys and backups.

Setup sequence for X-Road message log encryption

This sequence moves a Security Server from a plaintext message log to one where stored message bodies and signed archives are encrypted, with keys held under a decision the security officer and compliance lead have signed off. It runs on a non-production server first, so each check proves the setting, the key and the recovery path before the production change window opens.

  1. Confirm the installed version and guide sections

    The security officer or system administrator checks the installed X-Road version on each Security Server and confirms it is 7.8.3, 7.7.4 or 7.6.5, the supported versions. They then open the user guide for that version and read the sections on message logging and archives, confirming each setting name against that version's text. Done when the version and the guide sections used are recorded in the change ticket. The X-Road Security Server user guide is the starting point.

  2. Record the logging mode for each subsystem

    The system administrator lists every subsystem on the Security Server and records its current message log mode, while the security officer confirms which subsystems store full message bodies. Body encryption only protects what is stored, so subsystems on metadata logging hold no bodies for it to act on. Confirm whether archive encryption still applies to those subsystems, and mark each one as in scope or out of scope with a reason. Done when both the security officer and the compliance lead have reviewed the table and every subsystem has a mode and a decision.

  3. Decide key custody with the security and compliance owners

    The security officer and compliance lead decide where the encryption keys live and who may use them, and write the decision down before anything is created. A hardware security module is one option, since X-Road supports them through PKCS#11 drivers with the xroad-addon-hwtokens package for RSA and EC keys. Confirm in the user guide which key stores your version accepts for message log keys. The record should name the key holder, the people allowed to read the key backup, and who approves rotation. Done when a signed decision record exists and names those three owners.

  4. Create or load keys on a non-production server

    On a non-production Security Server, the system administrator creates the keys or loads the keys held on the chosen store, following the key steps in the user guide for the installed version. Access is limited to the Security Officer and System Administrator roles, so the system administrator signs in as each other role, including Registration Officer, Service Administrator and Security Server Observer, and confirms that none of them can reach the key functions. If admin login runs through PAM and SSSD with LDAP groups, confirm the group mapping before testing. Done when the role test is recorded and the test key loads without error.

  5. Enable body encryption and check for plaintext

    On the test server, the system administrator turns on message body encryption using the setting name confirmed in the user guide for the version, then sends test messages through the subsystems in scope. The security officer places a marker string in a test request body and searches the message log tables in PostgreSQL for it. Done when the marker does not appear in plaintext in any stored body and the message entries still show their metadata. Confirm table and column names in the database schema for your version before running the search.

  6. Enable archive encryption and verify signed archives

    The system administrator turns on archive encryption on the test server, using the setting confirmed in the user guide, and produces an archive from the test messages. Decrypt the archive with the stored key and confirm the output matches the test content. Then check that the signed archive still verifies with the verification method the user guide describes, since encryption must not break the evidential chain. Done when decryption and signature verification both succeed on the same archive and the results are saved with the test record.

  7. Back up data and key, then restore to a separate host

    Take an encrypted database backup and an archive backup, then store the key backup in a separate location with its own access list, so that no single copy holds both the data and the key. Restore the database backup, the archive backup and the key onto a host other than the source server. On the restored host, read one test message and decrypt one archive. Done when both reads succeed and the key backup location and its access list are recorded in the runbook.

  8. Document the procedure, owners and change window

    Write the procedure as a runbook covering the version, logging modes, key custody, enablement steps, checks and the restore test. Name the key rotation owner and the key recovery owner, and have each accept the role in writing. Book the production change in a window agreed with the business owners, then repeat the plaintext check and archive decryption on production after the change. Done when the security officer and compliance lead approve the runbook, both owners have accepted their roles, and the production window is booked.

Backing up keys without exposing them

An encrypted message log backup is only recoverable if its keys can be restored, so the key backup deserves the same planning as the data it protects. A backup set that holds keys next to the database dump or the archive files defeats the encryption, because anyone who obtains that set obtains both the lock and the key. Before you enable message body encryption or archive encryption, decide which key material must survive the loss of a Security Server, where each copy lives, and who can assemble it. Write that decision into the backup design. Confirm with your key management setup which files, devices or HSM partitions hold the material in your version, and list each location so the backup scope matches it exactly.

Keep the key backup in a separate store from the data backup and control it with split or dual custody. Divide the key material so that no single Security Officer or System Administrator can rebuild it alone, and give the parts to different custodians. A second option is to encrypt the key backup under a wrapping key held elsewhere, such as an HSM or a key service in a different administrative domain, so a copy of the backup on its own is useless. Offline or sealed storage suits copies that are rarely needed but must exist. The most common leak is operational: backup scripts, verbose job logs, transfer jobs or temporary directories that copy key files in clear text. Inventory every job that touches the key paths, exclude those paths from generic copies, and search job logs for key material before you trust the setup.

Restore drills are the only proof that keys and data can be recovered together. Run them on an isolated host built from the same version, restoring the database backup, the archive files and the key material from their separate stores, then confirm that message log entries decrypt and that archive files verify. Record each drill: the date, the backup set identifiers, who held each custody share and how the shares were combined, the key versions restored, the elapsed time for each stage, the checks that passed or failed, and any step that depended on knowledge held by one person. Treat each gap as a finding with a named owner and a retest date, and repeat the drill after any key rotation, change to backup tooling or change of custodians.

Who holds the keys in each team

The Security Officer decides how keys are held, changed and destroyed, and signs off the custody model before any key is generated or moved. This role sits alongside the Registration Officer, Service Administrator, System Administrator and Security Server Observer roles, so the approvals should name the person who holds each one. The Security Officer also owns the decision on hardware security modules. X-Road reaches an HSM through PKCS#11 drivers with the xroad-addon-hwtokens package, which supports RSA and EC keys, and that choice changes backup, recovery and vendor dependency.

  • Custody approval: Sign off on where each key lives, who may read or export it and how access is logged.
  • Rotation and destruction: Approve the schedule and the retirement steps, including what happens to archives encrypted under a retired key.
  • HSM decision: Own the choice between an HSM and software-held keys, and confirm the module works with the PKCS#11 setup before purchase.
  • Role separation: Confirm that one person cannot both change a key and alter its backup record.
  • Role assignment: Approve who holds each of the five Security Server roles before access is granted.

Evidence to keep: signed custody approvals, rotation and destruction records, and the HSM decision memo with its reasons.

Question to ask a vendor or partner before work starts: Which keys will sit in an HSM, and who can recover them if the HSM fails?

Check that the custody model and the recovery path are written down before any key is generated.

Security risks in key custody and backups

Encryption only protects the message log and archives if the keys and the people who administer them are controlled as tightly as the data. The six risks below cover where keys sit, how backups handle them, who can reach them, how administrators log in and whether the keys stay available.

Keys stored beside the data

Key files kept on the same host, disk or volume as the encrypted message log or archives give anyone who obtains one location both halves of the protection. A database dump, a disk snapshot or a copied server then exposes readable message bodies. Check where each key file lives, which file permissions apply to it, and whether it sits on a separate host or key service with its own access control. Store keys apart from the encrypted data and confirm this in writing for every Security Server.

Backups that copy keys

Backup jobs often archive whole directories, so they can copy key files alongside the message log and archives. If the backup set is unencrypted, or is readable by more people than the live system, the keys leave the controlled environment in usable form. Confirm that backup scripts handle key material on their own path, that key backups are protected by a separate mechanism, and that a restore test recovers both the encrypted data and the keys that open it. A backup that contains plain key files undoes the encryption.

Administrators who reach both sides

An administrator who can read the message log database and also reach the key store can decrypt the log without any other person involved. The Security Server defines separate roles, including Security Officer and System Administrator, so assign them to different people and check which functions each role reaches for key material. Remember that operating system root and database superuser accounts can read both sides as well, so include them in the same review. Separate duties, then test the separation with a named owner for each role.

Admin access and PAM login

The admin UI listens on TCP 4000 for internal networks, so restrict that port to administrator subnets and keep it off any external route. Admin logins go through PAM, which can use SSSD to connect to LDAP, with LDAP groups mapped to X-Road roles. Group mapping is optional, so decide whether role assignment comes from the directory or from local accounts. Confirm that removing a user from the directory also removes their X-Road access and that the mapping matches the role design.

Security Server user guide

Account hardening baseline

The X-Road security hardening guide, version 0.6 dated 09.01.2025, sets baseline controls for admin accounts. It recommends locking an account for 15 minutes after 3 failed logins, requiring passwords of at least 16 characters, using key-only SSH, and setting the allowed-hostnames setting against host header injection. Apply each control on every Security Server, then test it. Test each control, not only its configuration: trigger a lockout, attempt a password-only SSH login and send a request with an unlisted host header.

Hardening guidelines

HSM availability and failover

When keys sit on a hardware security module through a PKCS#11 driver, the module and its access path become a dependency for both signing and decrypting the message log. Losing the device, its network link or the driver can block both functions at once, which stops exchange and leaves stored logs unreadable. Confirm the failover design before relying on the HSM: ask the vendor and your own team about standby capacity, how the Security Server reconnects after an outage, and whether a restore path has been tested.

Security Server installation guide

How much effort and cost does X-Road message log encryption add?

How much does encrypting the X-Road message log cost?

DeployOpen's fee follows a fixed scope agreed in writing before work starts, so the quote depends on the Security Servers, subsystems, archive setup and environments in that scope. DeployOpen does not publish a price list. Several costs sit outside that fee. Your internal staff time is separate and covers key custody decisions, the key ceremony and restore drills. Any HSM hardware or licensing is additional, as is any managed PostgreSQL or storage service you choose for the message log or archives. Ask the quote to list each item separately, with what is one-time (setup, key ceremony, first restore drill) and what recurs (repeated drills, database and storage fees). Also ask whether the fee covers both test and production environments.

What makes X-Road message log encryption take more effort?

The main drivers are how many Security Servers and subsystems log message bodies, how much archive volume you produce and how archives are grouped, whether you use an HSM, which backup tooling already exists, and how many environments need testing. Each Security Server that encrypts bodies needs its database and archive settings checked, so a few servers is a different job from a large fleet. Archive volume and grouping decide how many encrypted archive files must be produced, verified and restored. An HSM adds PKCS#11 driver setup through the xroad-addon-hwtokens package, which handles RSA and EC keys, and it needs its own testing. Existing backup tooling decides whether keys and archives are captured without new work. Each extra environment, such as test, staging and production, repeats the checks in its own setting.

How long does X-Road message log encryption take to deliver?

The duration depends on the scope agreed in writing and on the change windows your organization can use, so no fixed length applies to every deployment. The schedule usually follows the number of servers and environments in scope, because each change needs a window in which message logging and archiving can be paused or checked. Key custody decisions and the key ceremony depend on your internal approvals, so start those early. The restore drill also needs a window in which production-like data can be restored and checked. Ask for a plan that shows each change window, who approves it and which steps depend on your internal decisions. Ask how a missed window moves the rest of the plan.

What do we need to provide for an X-Road log encryption project?

You provide test and production access, a logging mode decision for each Security Server or subsystem, and a key custody decision that names who holds the keys and how they are stored. You also share details of your backup and transfer tooling, since that tooling must capture the archive files, and you set a restore window in which the drill can run. Access should cover the Linux hosts, the PostgreSQL server that holds the message log and the archive destination. Decisions made late tend to extend the schedule, so name an owner for each one at kickoff. Ask for a written list of required access and decisions in the quote, and check it against your internal approval process before work starts.

Can our own team encrypt the X-Road message log without a partner?

Yes, if your team has Linux, PostgreSQL and PKI skills and reads the X-Road Security Server user guide for its version. The current release is 7.8.3, and the supported versions are 7.8.3, 7.7.4 and 7.6.5, so confirm which one you run before following any steps. Settle the key custody model before you change any setting, because the keys are what make archives readable later. The restore drill must be run before the change goes to production, whichever team runs the project. A team that has never restored an encrypted archive should treat the first drill as the test of the whole procedure.

What happens if we lose the key for encrypted X-Road logs?

Encrypted message log bodies and archives cannot be read without the key that protects them, so losing the key means losing access to that evidence. Recovery planning is therefore part of the setup, not an afterthought. Before you enable encryption, decide who holds the key material, where it is stored and how it is backed up. Backups should capture the key in a protected form without exposing it to people or systems that do not need it. Test the restore with the key in a separate environment, and record the procedure so another engineer can run it under pressure. Ask the implementation plan to show how the key ceremony, custody model and restore drill connect.

Rotating keys and recovering from a lost key

Plan key rotation before the first key is generated, because the rotation rule decides how every archive can be read later. List what stays under the old key: message log records already encrypted, archive files already sealed under it, and backup copies that hold the key. A common approach keeps the old key available for decryption for as long as the newest archive it protects must stay readable under your retention rules, then retires it by documented decision. Record which archives were produced before rotation and which after, so an auditor can see which key opens each file. Assign approval explicitly: the Security Officer role approves the rotation, the service owner confirms the retention period still applies, and both sign the change record before anyone runs the procedure. Ask the vendor whether the installed version keeps decrypting older records and archives with their original key once a new key is active.

Write the recovery runbook before a key is lost. The trigger is a confirmed or suspected loss of the key, a corrupted key store or a failed restore test, and the runbook should name who may declare it. Involve the Security Officer, the System Administrator who manages the server and its backups, the database owner for the message log, and a second approver who controls the separate key custody. Restore the key only from that custody location, then check it against a known archive before the system returns to normal use. Record each action with the person who performed it, the time, the check result and the approval reference in an evidence record kept outside the Security Server. The steps above are a planning structure, and each one must be confirmed in the user guide for your installed version or with the vendor before the runbook is approved.

Confirm the sequence with the vendor before you rely on it. The documentation this guide draws on does not describe key rotation or recovery for message log keys, so treat every step as provisional until it is confirmed. Ask how a new key is generated and activated, whether archives sealed under an old key remain openable after rotation, what a lost key means for records that depend on it, and whether a key can be restored from a custody copy without reissuing archives. Test the runbook on a non-production Security Server with sample data and keep that test record with the runbook. Repeat the rehearsal after each rotation and after each X-Road upgrade, because a version change can alter how the key store and the archive tooling behave.

Limits to confirm before enabling X-Road message log encryption

Message body encryption and archive encryption each depend on the X-Road version, the database service, the key storage and the evidence tools around them. The cards below list where a limit can block or change the rollout, and what to check in your own environment before you enable it in production.

Confirm body encryption in your version

The supported versions are 7.8.3, 7.7.4 and 7.6.5, and 7.8.3 is the current release. Version 7.8.0 is the last new-feature release of X-Road 7, so check that your installed build includes body encryption before you plan the rollout. NIIS intends to maintain X-Road 7 with bug fixes and security patches beyond 2026, but the length of that period has not been decided. Confirm the release notes for your exact patch level before you set a date.

X-Road releases

X-Road 8 is not yet production

X-Road 8 Spaceship is available as 8.0.0 Beta 2 for testing, and its production release is scheduled for December 2026. Do not plan production message log encryption on this beta from this page. Use the beta to review the design, and keep production on a supported 7.x release until X-Road 8 ships and your upgrade path is confirmed.

X-Road repository

Remote and managed PostgreSQL

The Security Server can use a local PostgreSQL service or a remote one, including managed services such as AWS RDS and Azure Database for PostgreSQL. Confirm how the provider's encryption at rest, snapshots and point-in-time backups interact with encrypted message bodies, because those copies hold data you have already encrypted at the application layer. Also confirm whether your DBA tools, such as dumps, replicas and provider support access, can read stored bodies, and who holds the keys that decrypt them.

Security Server installation guide

Archive transfer, grouping and retention

Encrypted archives have to leave the Security Server, be grouped and be retained on the archiving side, and every step must handle the encrypted files intact. Confirm that the transfer keeps archives unchanged, including file names and groupings that your retention process relies on. Also confirm that the receiving storage keeps access to the keys needed to open archives for the full retention period. Treat the transfer step as a separate design decision, and read the archive transfer topic before you set the schedule.

HSM coverage for message log keys

The documented PKCS#11 support covers RSA and EC keys through the xroad-addon-hwtokens package. Confirm that the key type and mechanism you plan to use for message log keys fall within that coverage, because a key type outside it needs a different design. Also check key generation, backup and rotation, and what happens to archived messages if the HSM is unavailable during a restore.

Evidence retrieval on encrypted content

Signed document verification and log queries are the tests of whether evidence still works after encryption. Confirm that both still work on encrypted content before production. Retrieve a signed document and run asicverifier against a message logged with encryption enabled, then run the log queries your audit and dispute processes use. Record the results, the X-Road version and the key identifiers involved, so an auditor can see that the evidence path was checked.

Security Server user guide

How DeployOpen scopes and delivers message log encryption

DeployOpen treats message log encryption as a planned change to a self-hosted X-Road Security Server, carried out in your infrastructure with your database, keys and backup tooling. The work starts from a written scope that names which databases, archives and key stores are covered, and each step is verified before the next one starts. Ongoing support after go-live is available as a retainer.

How we scope

  • The written scope lists each Security Server, its PostgreSQL message log database and every archive location in scope.
  • Key custody is agreed first: where keys are generated, which HSM or key store holds them, who approves access.
  • Engagements are fixed-scope, so the quote follows from the written scope and its deliverables.

How we build

  • Build in a non-production copy first, with the message log database and a test key set, before any production change.
  • Keep keys apart from the data they protect, and confirm whether your HSM can hold them.
  • Test that a message still logs, archives and verifies after encryption is enabled, using the same archive steps as production.

How we hand over

  • Handover documents key locations, key lifecycle steps, backup coverage for keys and the restore procedure we tested.
  • Your team receives runbooks for keys, backups and archive encryption, written for the operators who will run them.
  • Evidence for compliance reviews is prepared for your assessors, though independent auditors issue the assessment itself.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers after handover.
  • Key lifecycle, restore tests and X-Road upgrades recur, so the retainer scope should name them.
  • Ask how a retainer covers 7.x patch releases and any move to X-Road 8 after its planned release.

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.