Join our Newsletter — 33% off our NHI Course
Home› Guides› HSM Migration Playbook: Moving Keys Between HSMs and…
Template Data Security

HSM Migration Playbook: Moving Keys Between HSMs and Vendors Without Exposure

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 27 November 2026 14 min read
On this page

Moving keys off an old hardware security module is the one time a key designed never to leave its boundary has to go somewhere else, and most migration exposures happen in that gap. This template gives [Organisation] a phased playbook for migrating keys between HSMs, whether a firmware generation change, a move from on-premises appliances to a dedicated cloud HSM, or a change of vendor. It covers how to inventory and classify keys, choose a transfer method per key, run the ceremonies under dual control, cut applications over with a rollback path, and retire the old hardware. It is written for PKI and cryptography engineers, key custodians and the HSM service owner. It assumes the target HSMs are already deployed and hardened as described in the HSM Deployment and Operations Guide; ongoing operation after migration is in the Hardware security module (HSM) day-2 operations runbook.

How to use this template

  • One playbook per migration: fill in a copy per source and target pair. A migration that moves payment keys and enterprise PKI keys at the same time is two migrations, because payment keys follow card scheme and PCI PIN rules.
  • Replace the square brackets: [brackets] mark placeholders. HSM products use different names for partitions, security domains, administrators and backup formats; record the mapping for source and target in Section 1.
  • Do not generalise across products: what a "non-exportable" key means, whether a vendor backup can be restored onto different hardware, and which wrapping mechanisms are supported all vary by product and firmware. Every method in Section 4 is confirmed against both vendors' current documentation before it is chosen.
  • Ceremonies use the existing template: each key transfer is a scripted ceremony; use the Cryptographic Key Ceremony Template for the script and record.
  • Owner and approval: [HSM Service Owner] owns the playbook; [Change Advisory Board] and [Head of Cryptography or CISO] approve the migration plan and each production cut-over.

1. When to use this playbook

1.1 Use this playbook for: hardware refresh to a new HSM model or generation; firmware that cannot be upgraded in place; loss of a FIPS 140-2 or FIPS 140-3 validation that your policy requires; consolidation of HSM estates after a merger; moving between on-premises and dedicated cloud HSMs; changing HSM vendor.

1.2 FIPS context: NIST's CMVP transition page states that FIPS 140-2 validations move to the historical list in September 2026, while historical modules can still be used for existing systems and agencies decide when to require FIPS 140-3 only. If policy requires a current validation, record the certificate number of the target module and firmware in Section 1.4. See FIPS 140-2 vs FIPS 140-3.

1.3 Out of scope: responding to a suspected key compromise (use the Encryption Key Compromise Playbook; a compromised key is replaced, never migrated) and choosing the target platform (see the HSM and Key Management Buyer's Guide).

1.4 Migration record: source HSMs [model, firmware, validation certificate], target HSMs [model, firmware, validation certificate], terminology mapping, target completion date, and date by which the source must be decommissioned (support end, lease end, data centre exit).

2. Roles and key ceremonies

RoleMigration dutiesMust not also be
HSM service ownerOwns plan, risk acceptance and decommissioning sign-offA key custodian for the same key
Security officers (source and target)Initialise target partitions, create transport and wrapping keys, set key policies and attributesThe application owner
Key custodiansHold shares, smart cards or key components; attend ceremonies; each holds only their own partHolders of another share of the same key
Ceremony administratorRuns the script, keeps time, ensures each step is witnessedA custodian in the same ceremony
Independent witnessObserves, signs the ceremony record, checks tamper-evident bag numbersAnyone with HSM credentials
Application ownersRepoint applications, test, own rollback for their serviceA security officer
Auditor or QSA/QPA (payment keys)Reviews evidence; for PIN keys, assesses against PCI PINCeremony participant

2.1 Dual control: no single person can perform a key transfer, export, import or destruction alone. Quorum (M of N) is enabled on source and target for these operations where the product supports it.

2.2 Split knowledge: any key or transport key that exists outside an HSM, even briefly, exists only as shares or components. NIST SP 800-57 Part 1 Rev. 5 defines split knowledge as a key split into shares, each of which provides no knowledge of the key. Components are held by different custodians, carried in tamper-evident packaging and never photographed or typed into a general-purpose computer.

2.3 Ceremony record: script version, participants, room and equipment, every command or menu action, key check values (KCVs) or fingerprints before and after, tamper bag serials, start and end times, deviations and signatures. Retain for [retention period].

3. Phase 1: inventory and classify keys

3.1 Export a full object list from every source partition: label, key type and length, algorithm, creation date, attributes (in PKCS #11 terms, CKA_EXTRACTABLE, CKA_SENSITIVE, CKA_NEVER_EXTRACTABLE), owning application, and the application identity that uses it. Reconcile against the key inventory in the Cryptographic Key Management Guide format; orphaned keys are investigated, not migrated by default.

3.2 Classify each key:

ClassExamplesDefault approach
Long-lived trust anchorsOffline root CA, code signing roots, firmware signing keysTransfer if relying parties cannot be updated in time; otherwise re-key with a planned trust anchor rollover
Issuing and signing keysIssuing CA keys, document or token signing keysRe-key on the target and cross-sign or publish the new key alongside the old one
Data encryption keys and key encryption keysDatabase TDE master keys, storage KEKsTransfer if existing ciphertext must stay readable; or re-wrap data keys under a new KEK generated on the target
Payment keysPIN encryption keys, zone master keys, card verification keysFollow scheme and PCI PIN rules; see Section 4.4
Session or short-lived keysTLS keys rotated within daysDo not migrate; generate new on the target at cut-over
Retired or archived keysOld decryption keys kept for recordsMigrate only if a retention rule requires decrypting old data; otherwise destroy at decommissioning

3.3 Record for each key the chosen method (Section 4), the cut-over date and the rollback approach. Keys whose method cannot be confirmed with both vendors are blocked until it is.

4. Phase 2: choose a transfer method

4.1 The first question for every key is whether it needs to move at all. Generating a new key on the target and rotating to it (re-keying) never exposes the old key, and is the default for any key whose relying parties or ciphertext can be updated.

MethodHow it worksWhen it fitsExposure and constraints
Re-key on targetGenerate a new key inside the target HSM, distribute the new public key or certificate, rotate applications, retire the old keyMost issuing, signing and session keys; any key that can be rotated within the migration windowNo key leaves an HSM. Costs coordination with relying parties and re-encryption or re-signing work
HSM to HSM key wrappingAgree a transport key (KEK) between source and target, wrap the key on the source, unwrap on the targetExtractable keys that must keep the same value; vendors that support a common wrapping mechanismPKCS #11 C_WrapKey requires the target key's CKA_EXTRACTABLE to be true. Use an approved key wrap such as AES KW or KWP from NIST SP 800-38F. The transport KEK must be at least as strong as the key it protects
Transport key from componentsThe KEK is entered on both HSMs as separate components under dual control, then used for wrappingDifferent vendors with no shared key agreement; payment environments that use component entryComponents exist outside the HSM, so split knowledge, tamper-evident handling and KCV checks are mandatory
Vendor backup and restoreRestore a vendor-format encrypted backup or clone onto target hardware that shares the backup or domain keySame vendor, compatible models or firmwareUsually works only within one vendor's product family; confirm restore compatibility between source and target firmware
Non-exportable keysKey was created with export disabledOnly via a vendor-supported same-family mechanism, if one existsTreat as re-key unless the vendor documents a supported path. Never weaken attributes on production keys to make them exportable

4.2 Provenance: under PKCS #11 C_UnwrapKey, an unwrapped key has CKA_NEVER_EXTRACTABLE and CKA_ALWAYS_SENSITIVE set to false, and CKA_EXTRACTABLE defaults to true unless the unwrap template sets it otherwise. Set CKA_EXTRACTABLE false and CKA_SENSITIVE true in the unwrap template, and note in the key record that the key was imported, because some attestation and compliance checks rely on "never extractable".

4.3 Key wrapping templates: where the product supports CKA_WRAP_TEMPLATE, restrict which keys the transport KEK can wrap; a wrap attempt that does not match the template fails, which limits what an operator error or a compromised session can export.

4.4 Payment keys: PCI PIN Security covers secure management of PIN-related keys across their lifecycle, including conveyance and loading. Agree the method, key block format and evidence with your Qualified PIN Assessor before the ceremony. See Payment HSMs and the PCI PIN Security and Key Management Operations Guide.

4.5 Choosing between transfer and re-key:

  • Re-key when: the key can be rotated within the window, relying parties can trust a new key, or the key is non-exportable.
  • Transfer when: years of ciphertext depend on the key, a root is embedded in devices you cannot update, or a regulator or scheme requires continuity.
  • Small estates: a team with fewer than [20] keys often re-keys everything and avoids transport ceremonies. Large estates usually split: re-key the bulk, transfer a short list of anchors and KEKs.

5. Phase 3: migrate and cut over

  1. Rehearse: run the full method with test keys between non-production source and target partitions; time each ceremony and fix the script.
  2. Prepare the target: create partitions, roles, quorum and application identities on the target; store new application credentials in the secrets manager, never in configuration files.
  3. Transfer or generate: run each ceremony per Section 2.3. After transfer, compare KCVs or public key fingerprints between source and target and record both.
  4. Prove use: on the target, sign and verify, or encrypt and decrypt, a known test value with each key before any application points at it.
  5. Cut over by application: one application at a time, in a change window, switching the client library and connection settings. Start with the lowest-risk service.
  6. Parallel run: keep the source HSM serving the old path, read-only where possible, until the application has completed a full cycle (a certificate issuance, a CRL publication, a batch run, a month end).
  7. Rollback: if errors exceed [threshold] or a test fails, switch the application back to the source configuration, which stays untouched during parallel run. Keys generated only on the target during the window (for example new certificates) are listed so they can be revoked or carried back.
  8. Close each application: owner signs off; the source path is disabled, not yet destroyed.

6. Phase 4: validate and decommission

6.1 Validation before decommissioning: every migrated key is used successfully on the target in production; no application connects to the source (check source audit logs for logins and key use over [30] days); a restore of the target backup has been tested; and the key inventory shows the new location.

6.2 Destroy keys on the source deliberately. NIST SP 800-57 Part 1 Rev. 5 describes key destruction as removing all traces so a key cannot be recovered by physical or electronic means. Destroy keys under dual control, then run the vendor's documented zeroisation or factory reset for the module, and record the output.

6.3 Backups and tokens: locate every backup of the source keys (backup HSMs, encrypted backup files, smart cards, key component envelopes) and destroy or zeroise them, unless a retention rule requires keeping one, in which case record the exception and its owner. Old backups are the most common place for migrated keys to survive.

6.4 Hardware: sanitise or physically destroy the modules according to NIST SP 800-88 Rev. 2 Guidelines for Media Sanitization and your disposal policy, keep certificates of destruction, and update the asset register. See the Media Sanitisation Guide. Return-to-vendor or resale of an HSM happens only after zeroisation is verified and witnessed.

6.5 Revoke and clean up: disable source HSM accounts and application credentials, remove network rules and client libraries, and revoke any certificates issued to the source partitions.

Common failure patterns

  • Making production keys exportable to move them: weakening attributes leaves keys exportable on the source and sometimes on the target. Re-key instead, or use a documented vendor path.
  • Transport keys that outlive the migration: a KEK left on both HSMs can still wrap keys out years later. Destroy it at the end of each transfer ceremony and record the destruction.
  • Forgotten backups: the source HSM is zeroised but old backup files and backup tokens survive in a safe or a cloud bucket.
  • No parallel run: the source is destroyed before an annual or monthly process has run on the target, and a missing key surfaces too late to roll back.
  • Assuming backup portability: a vendor backup taken on one firmware or model will not restore on another, discovered during the production window instead of in rehearsal.
  • Lost provenance: imported keys are recorded as generated on the target, and a later audit or attestation check gives a false result.

Practitioner checklist

  • Source and target validation certificates and firmware recorded.
  • Every key classified with a method, owner, cut-over date and rollback path.
  • Transfer method confirmed in both vendors' current documentation and rehearsed with test keys.
  • Quorum enabled for export, import and destruction on source and target.
  • Components and shares held under split knowledge with tamper-evident handling.
  • KCVs or fingerprints matched and recorded for every transferred key.
  • Each application parallel-run through a full business cycle before the source path is disabled.
  • Transport keys destroyed after use.
  • All source keys, backups and tokens destroyed or zeroised, with witnessed records.
  • Hardware sanitised per SP 800-88 Rev. 2 and asset register updated.

Implementation guidance

  1. Start with the inventory: the object list usually finds keys nobody owns and keys that are no longer used. Retire those before the migration and the method decisions get shorter.
  2. Measure progress: track keys migrated or re-keyed against plan, applications cut over, rollbacks invoked, ceremonies completed without deviation, source logins in the last 30 days (target zero before decommissioning), and backups and tokens accounted for.
  3. Cloud HSM targets: the provider handles hardware disposal on its side, but import methods, attribute settings and the destruction of your source estate remain your responsibility; record the split.
  4. Framework mapping: the playbook supports NIST SP 800-53 SC-12 and SC-12(1) Availability, AC-5 Separation of Duties, CM-3 Configuration Change Control, CM-4 Impact Analyses, CP-9 System Backup, MP-6 Media Sanitization and SR-12 Component Disposal, and NIST CSF 2.0 PR.DS-01, PR.PS-03 and ID.AM-08. The Cryptographic Key Management Policy Template holds the policy statements this playbook carries out.
  5. Afterwards: run the Hardware security module (HSM) health check on the target within [90] days of the last cut-over.

Standards and references

Related NHI Mgmt Group resources: HSM Deployment and Operations Guide · Hardware security module (HSM) day-2 operations runbook · Cryptographic Key Ceremony Template · Crypto-Agility Guide · FIPS 140-3 and Cryptographic Module Validation Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.