When an HSM fits Hyperswitch key management
An HSM is worth considering when your key custody requirements or audit expectations go beyond what a cloud KMS or HashiCorp Vault backend can give you, for example when an assessor or board expects key material to be generated and held in tamper-resistant hardware that your team controls. Hyperswitch splits sensitive data across services. The card vault (locker) is a separate Rust service in the juspay/hyperswitch-card-vault repository, and the encryption service manages the keys that protect data held in that layer. Both depend on a configured key storage backend, so the backend choice is a configuration decision with its own trade-offs in latency, availability, staffing and cost. Before you plan hardware, check the Hyperswitch self-hosting documentation to confirm which backends your chart version supports directly, and whether HSM-held keys are reached through a KMS or Vault front end.
Start by deciding whether the requirement is real, because it depends on your vault model. Hyperswitch documents that in the self-hosted, in-house PCI model the merchant is fully responsible for PCI DSS certification and data handling, so card key custody sits squarely in your scope. If you use an external PCI vault provider or the SaaS Hyperswitch Vault, cards are held elsewhere and the HSM question shifts toward connector credentials and any remaining local keys. Ask your assessor which key management controls they expect, and map each one to the backend that provides it. An HSM adds procurement, data center or managed service contracts, firmware and patch management, and a hardware dependency that must be highly available, since the vault cannot unlock without its keys. Price these as recurring operating costs as well as the one-time purchase or setup.
How keys flow between the app server, vault and key backend
The diagram starts at the Router app server, which hands card and connector data to the card vault and encryption service. Those services wrap their data keys using the key backend, which can be a cloud KMS, HashiCorp Vault or an HSM-backed service, and only encrypted data reaches PostgreSQL. The dashed trust boundary marks the key backend and the custodians who hold unlock material, so check which side of that line each key, credential and audit log sits on before you build.
Key and data flow between the app server, vault, key backend and custodians.
Which key storage backend fits which situation
In a cloud-hosted deployment, a cloud KMS is usually the lowest-operations option for the key material that the card vault and encryption service depend on. The provider runs the underlying key hardware and most of the availability work, while your team owns key policies, IAM roles, key region, rotation and alerting. Hyperswitch documents an AWS KMS path for the vault and encryption service charts, so the decision for a cloud-hosted stack is often between that path and a self-run HashiCorp Vault cluster inside the same account. Check the Hyperswitch self-hosting guide for the backend options that match your chart version.
- What your team operates: key policies, IAM roles for the service accounts, key region, rotation schedule and logging of key use.
- Who holds custody: the cloud account owner and the key administrators you name, with the provider operating the underlying hardware under its shared responsibility terms.
- Failure path: the app server cannot unwrap keys while the KMS endpoint or IAM path is unavailable, so test that outage before go-live.
- Recurring cost: key requests and key storage are billed by the provider, so request current pricing from the provider instead of estimating it.
- Custodian ceremony: dual control for the master key still applies in the cloud, so plan who approves key changes separately from who administers the account.
Before committing, confirm with the Hyperswitch docs which KMS backend settings and configuration keys your chosen chart version accepts for both the vault and the encryption service.
On-premise, the most common alternative to a cloud KMS is a HashiCorp Vault cluster that your own team runs in the same data center as the Hyperswitch Kubernetes cluster. Hyperswitch documents a HashiCorp Vault backend for the vault and encryption service, which makes it the natural candidate when no cloud KMS is available. An HSM is also possible in this environment, but the documented path for a hardware module should be treated as something to confirm with Juspay, and a custom integration would add build and test work to your scope. Plan the Vault cluster, its storage backend and its unseal process before you touch the Hyperswitch charts.
- What your team operates: the Vault cluster, its high availability, storage backend, backups, upgrades, auth methods and the Kubernetes network paths to it.
- Who holds custody: the security team holds the Vault unseal material and administrative roles, while Hyperswitch custodians hold the separate master key material used by the vault.
- HSM path: if you plan an HSM, decide whether it sits behind Vault or is reached directly, and confirm that the chosen design is documented or supported before procurement.
- Access model: restrict which service accounts can read the key path, and log every read and token issue.
- Capacity and placement: keep Vault nodes in separate failure domains, since the app server depends on it at startup and during unlock.
Before committing, confirm the token and URL settings, supported authentication methods and Vault version compatibility in the Hyperswitch documentation for your chart version.
In an air-gapped network, a cloud KMS is generally unavailable, so the key backend must run inside the isolated environment. The decision then depends on whether the Hyperswitch chart and its key backend can run with no outbound calls, which the team must verify rather than assume. A HashiCorp Vault cluster on the isolated network is the usual documented route for the Hyperswitch backend, while an on-site HSM typically requires a custom integration or a backend that Juspay confirms for this use. Key ceremonies, backups and software transfer all become manual procedures, so they need to be written before the first deployment.
- What your team operates: the isolated Vault or HSM service, internal image and chart mirrors, offline backups of key material, and the transfer process for updates.
- Who holds custody: key material is split among named custodians under dual control, with the ceremony recorded and witnessed by someone outside the operating team.
- Update path: each release and dependency must move across the air gap through a controlled process, which adds lead time to every upgrade.
- Recovery: test restoring key material from offline backups into a rebuilt environment, because a lost master key can make the stored card data unreadable.
- Audit evidence: keep logs of key ceremonies, access reviews and transfers so an assessor can trace each key event.
Before committing, confirm with Juspay that the chosen backend works with no outbound network access and that your assessor agrees with the custody model for the card data.
Key storage options and when each one fits
This table compares cloud KMS, HashiCorp Vault and a dedicated HSM as key storage backends for Hyperswitch keys across custody control, operating burden, audit evidence, availability dependencies and cost drivers. Read each row against your own custody model and confirm the backend details with Hyperswitch and the vendor, because the supplied facts do not confirm which HSM interfaces Hyperswitch accepts. The main takeaway is that an HSM adds custody control only if your custodian and audit procedures are designed around it from the start.
| Criterion | Cloud KMS | HashiCorp Vault | Dedicated HSM |
|---|---|---|---|
| Custody control | Keys are held by the cloud provider's service under your account and IAM policies. Confirm who can administer the key and whether you can export or restrict it. | Keys are held in Vault's storage and protected by unseal and token policies you operate. Custodian roles map onto Vault policies you design. | Keys are generated and kept inside tamper-resistant hardware that you or your custodians control physically. Confirm the custody model with your HSM vendor. |
| Operational burden | Low for key storage itself. You still own IAM roles, key policies, region choice and access logging for the Hyperswitch services that call the key. | Moderate to high. You run the cluster, high availability, unseal procedures, upgrades and backups of Vault's own state. | High. You manage racks or appliances, firmware, redundancy, physical access and vendor support contracts, plus integration work with the Hyperswitch backend. |
| Audit evidence | Key use is logged by the cloud provider's audit service. Confirm which events are retained and for how long in your account. | Audit devices write request logs that you must ship and protect. Confirm log format and retention with the Vault documentation for your version. | Vendor tooling records administrative and key events on the device. Confirm what the device logs and how custodian actions are recorded. |
| Availability dependencies | The vault and encryption service depend on the cloud KMS endpoint and its regional availability. Plan for outage behavior in your design. | Depends on Vault's high availability design and your network path to the cluster. Vault being sealed blocks unlocking the card vault after restarts. | Depends on the HSM cluster, its network path and failover configuration. A single unavailable device can block key operations if redundancy is not designed in. |
| Hyperswitch fit | Documented as a KMS backend option in the Hyperswitch deployment docs. Confirm the exact chart values and IAM setup for your version. | Documented as a backend option for the vault and encryption service. Confirm the token, URL and policy settings in the Hyperswitch docs. | Confirm whether Hyperswitch supports a direct HSM interface or whether an HSM sits behind KMS or Vault. Do not assume direct PKCS#11 support. |
| Cost drivers | Recurring usage and key charges from the provider, plus the engineering time to set IAM policy. Ask the provider for its current pricing terms. | Largely infrastructure and staff time to run the cluster, plus any enterprise license terms you choose. Ask the vendor which features need a license. | One-time hardware and licensing, recurring support and maintenance contracts, and the time for physical custodian ceremonies and audits. Request a written quote covering all of these. |
| Fits when | You want managed key storage in your cloud account and accept the provider as a dependency for key operations. | You run on-premises or multi-cloud and want one secrets platform with self-managed availability and audit. | A regulator, assessor or internal policy requires keys to sit in dedicated hardware under your physical custody. |
How to plan an HSM integration step by step
This sequence takes a team from confirming which key backend a Hyperswitch release supports to a tested cutover with a rollback path. Each step closes with an output or check, so custody, hardware and custodian decisions are settled before any production key moves.
Confirm the supported key backend
Check the key storage options documented for the exact Hyperswitch release and chart version you plan to run, covering the card vault and the encryption service. Read the Hyperswitch self-hosting docs and ask Juspay to confirm whether an HSM is reached directly or through a supported KMS or vault interface. Platform engineering owns this step. It is done when you hold a written note naming the supported backend, the chart version and the upgrade path that keeps that backend available.
Define custody requirements and audit evidence
Write down who may generate, load, hold and use key material, how many people must act together, and which records an assessor will ask for. Agree with your compliance lead or QSA how these rules map to your PCI DSS scope decisions, and set retention periods for access and change logs. Security, compliance and platform owners sign the document. It is done when every requirement names an owner and an evidence source, such as HSM audit logs, change tickets or custodian sign-off forms.
Choose the HSM model and hosting
Select a hardware security module and its location that your organization can operate, such as an on-premises appliance, a dedicated cloud HSM in your own account, or a managed service you control. Evaluate high availability, firmware support, backup, and whether your operations team has the skills to run it. Ask each vendor to confirm in writing which client interface and regions or sites it supports, and check that the interface matches the backend from step one. It is done when a decision record holds the model, hosting and failover design.
Design key generation and custodian roles
Decide where master and encryption keys are generated, how they are split or wrapped, and which custodians hold each share or credential. Keep HSM administration, custodian duties and Hyperswitch release operations with different people, and document who witnesses each ceremony. Write the ceremony steps as a script with no ad hoc actions. It is done when a tabletop walkthrough assigns each role to a different named person and the script runs from start to finish without improvisation.
Build a non-production integration
Deploy the card vault and encryption service in a non-production cluster and point them at a test HSM partition or test backend, loading only test keys. Pin the chart and image versions you intend to promote to production. Record every configuration key, secret reference and network path in version-controlled values files. It is done when test payments store and retrieve a test card token, and the services start without relying on local key material.
Test restart and unlock flows
Restart the vault pods, the encryption service, the database and the HSM connection in turn, then run the unlock sequence with the custodians you designed. Include scenarios such as losing one custodian, an HSM failover, an expired session and a network interruption between the cluster and the HSM. Record the result of each scenario and the fix for any failure, then repeat the tests after each change to configuration. It is done when the services return to serving requests after every scenario and no step needs access that is undocumented.
Cut over with a rollback plan
Run the production key ceremony, switch the vault and encryption service to the HSM-backed configuration in an approved change window, and keep the previous key path available until the rollback window closes. Ask Juspay whether existing stored data needs re-encryption for your release before retiring any old key material. Platform, security and compliance sign the cutover record. It is done when a post-cutover check decrypts a sample of existing records and every key operation has an audit log entry.
Custodian, audit and operational controls around the HSM
An HSM only protects Hyperswitch keys if the people and procedures around it hold up. The cards below cover custodian controls, restart procedures, rotation, logging, failover and the split of duties between platform and security teams. Items marked to confirm depend on the specific vault and encryption service versions and the backend you choose.
Dual control and custodian lifecycle
Key material for the card vault should never sit under one person's control. Define who holds each custodian share, how many custodians must be present to unlock, and how new custodians are onboarded and removed. Write the offboarding runbook before anyone leaves, because a departing custodian must be replaced without re-exposing key material. Confirm with the Hyperswitch vault documentation exactly how custodian keys are generated and whether a custodian can be rotated without re-encrypting stored cards.
Hyperswitch docsUnlock sequence after restarts
A vault that restarts may need its keys unlocked again before it can serve requests. Document the exact order of steps: which pods or services restart first, when custodians must be present, and how the app server behaves while the vault is locked. Rehearse this sequence in a non-production environment, including a restart at 2 a.m. with one custodian unavailable. Confirm the unlock behavior for your chosen backend, since KMS, HashiCorp Vault and HSM setups differ.
Key rotation and re-encryption
Rotation has two parts: the key that wraps data encryption material and the custodian material that unlocks it. Decide how often each is rotated, who authorizes the change, and whether stored card data must be re-encrypted during the process. Ask the vendor or your HSM administrator how the backend handles key version history, so older records remain readable during a rotation window. Test a rotation end to end in staging before relying on it in production.
Access logging and audit trails
Every key operation, unlock, custodian action and configuration change should produce a log entry that is stored outside the systems it records. Confirm which events the vault and encryption service emit, where they go, and how long they are retained. Forward them to your central logging platform and set alerts for unlock attempts that fail or occur outside a change window. Your auditors will ask for evidence that these controls operated, not only that they exist.
HSM failover and backup of key material
A single HSM is a single point of failure for every vault unlock. Decide whether you need a second HSM partition or cluster, how keys are replicated between them, and what happens when the primary is unreachable. Key backups must be encrypted, stored in a separate location, and restored in a tested procedure. Confirm with your HSM vendor which backup and cloning mechanisms they support and whether those mechanisms meet your key custody requirements.
Separation of duties between teams
Platform engineers should deploy and run the Hyperswitch stack, while security staff should hold custodian roles and approve key changes. Write this split down as a responsibility matrix covering deployment, unlock, rotation, log review and emergency access. Avoid giving one engineer both deployment rights and custodian shares, since that combination undermines dual control. Review the matrix each time the team changes or a new environment is added.
Questions teams ask before an HSM project
Do we need a hardware security module for Hyperswitch keys?
No. A hardware security module is not required to run Hyperswitch, and the documented key storage options include cloud KMS and HashiCorp Vault backends as well as HSM-backed setups. The decision depends on your custody and audit requirements: whether your security policy, your assessor or your internal control framework expects keys to be generated and held in tamper-resistant hardware, and whether you need that hardware to be under your own physical control. If your policy accepts a managed key service with strict access logging and split custody, a software-backed option may be enough. Confirm the requirement with your security and compliance leads before you pick a backend.
What drives the cost of an HSM project for Hyperswitch?
The cost has four main parts. First, the hardware or managed HSM itself, which is either a purchase with support contracts or a recurring managed service, depending on whether you run it in your data center or use a cloud provider's offering. Second, integration work to connect the key storage layer to the card vault and encryption service configuration. Third, custodian process design, covering who holds which key material, how dual control works and how unlock steps are written down. Fourth, testing and verification, including failover and restart scenarios. Ask any partner or internal team for a quote that lists each part separately and states which costs are one-time and which recur.
How long does an HSM integration take?
The duration depends on scope and environment, so no fixed figure applies. The biggest variables are whether the HSM is already procured and racked, whether your network and cloud access are ready, how many custodians must be trained and approved, and how many environments (test, staging, production) need the same procedure. Procurement lead times for hardware can exceed the integration work itself. Ask for a written plan with milestones for hardware delivery, configuration, custodian sign-off and verification, and treat any duration without a stated scope as incomplete.
What must our team provide before an HSM engagement starts?
Plan to supply four things. Provide access to the target cloud accounts or data center network, including the network paths the HSM client needs and the identity roles that will call it. Name the custodians who will hold key material, with their roles and backup contacts. Share your audit requirements, including which logs must be retained, who reviews them and which control frameworks the evidence will be used for. Finally, provide the current Hyperswitch deployment details, such as the Helm chart version, the environments in scope and the backup and restore procedure. Missing items usually delay the custodian design more than the technical setup.
Can our own team run an HSM integration without a partner?
Yes, if your team already has the skills in Kubernetes secrets handling, key management, network security and audit logging. Many teams do the configuration in-house and bring in outside help only for specific gaps. A partner adds the most value in design decisions, such as choosing between an HSM, a cloud KMS and HashiCorp Vault, and in independent verification, where someone outside the build team tests restart and unlock procedures and checks that the evidence trail is complete. Whichever route you choose, write the custodian runbook before go-live and have it reviewed by someone who did not write it.
What breaks most often in an HSM-backed Hyperswitch setup?
The most common failures are operational rather than technical. Teams often skip testing the unlock sequence after a node restart, so the first real restart in production stalls. Custodian turnover is another frequent gap: when a person leaves, nobody has a tested procedure for replacing their role. Network path changes, such as a firewall rule or a new cluster subnet, can silently block the key service from reaching the HSM. Finally, audit logs are sometimes enabled in the HSM but not forwarded to the place where your reviewers look. Build a test that restarts the vault and encryption service, and check that each of these items is covered before go-live.
Which Hyperswitch vault model changes the HSM decision?
The vault model determines how much key handling is your responsibility. In the self-hosted model with the native Hyperswitch Vault, the merchant is fully responsible for PCI DSS certification and data handling, so the custody design carries more weight. Under self-hosted orchestration with an external PCI vault provider or the SaaS Hyperswitch Vault, card data sits outside your environment, and the keys you manage mostly protect connector credentials and other sensitive settings. Confirm with your assessor which keys fall in scope under your chosen model before you commit to hardware.
How to decide between cloud KMS, Vault and an HSM
The decision starts with the custody and audit requirement that your security or compliance team writes down, and only then moves to products. That requirement should answer four questions: who may cause keys to be used, who holds custodian material, what evidence of key use must be retained, and where the key material must physically and legally sit. If you run the in-house PCI model, the Hyperswitch docs make the merchant fully responsible for PCI DSS certification and data handling, so the answers to these questions feed directly into your assessment scope. Write them as testable statements, such as which roles can unwrap the vault data key and where those events are logged, so that each backend can be checked against them in the same way.
The second step is to check which key storage backends the documented layer supports for your deployment. Confirm this against the Hyperswitch release you intend to run, because backend settings are defined per chart and per version, and the self-hosting guidance is the starting point for that check. Ask whether an HSM can be reached directly by the card vault and encryption service, or only through a cloud KMS or HashiCorp Vault integration, and whether that path is documented or would be custom work that your team must own and retest on every monthly minor release. Remove any option that the documented layer does not support for your target version before you compare costs, because an unsupported path is a design risk, not a configuration detail.
Only after that filter should you weigh operational burden. A cloud KMS usually leaves the least infrastructure to run, but it ties key use to the provider's key policies, regions and identity configuration. HashiCorp Vault adds a service you must make highly available and unseal correctly, with its own backups and access model. An HSM adds hardware procurement, firmware management, clustered backup of key material and staff who can operate it. Ask any integrator for a quote that separates one-time work (design, integration, custodian ceremonies, evidence set-up) from recurring work (patching, retesting after upgrades, audit support). DeployOpen prepares systems, controls and evidence for compliance assessments, but independent auditors and certification bodies issue the reports and certifications.
How DeployOpen works on this
DeployOpen plans and implements self-hosted open-source platforms inside your own infrastructure, so an HSM integration for Hyperswitch key management is scoped against your key custody rules, your audit obligations and your existing Hyperswitch deployment before any configuration changes. The work is agreed in writing as a fixed scope, with deliverables and timelines confirmed up front.
How we scope
- We confirm which Hyperswitch key storage layer you run today and whether an HSM is needed, or whether a cloud KMS or HashiCorp Vault already meets your custody requirements.
- The written scope lists the key hierarchy, custodian roles, HSM model and network path to the HSM that we will configure and test.
- We agree the audit evidence you need from the HSM and key operations before work starts, so the deliverables match what your assessors will ask for.
How we build
- We stand up the integration in a non-production environment that mirrors your Hyperswitch deployment, including the card vault and encryption service configuration.
- We test key generation, unlock after restart, key rotation and failover of the HSM connection, recording each result against the agreed scope.
- We review HSM access controls, service account permissions and network segmentation with your security team before any change reaches production.
How we hand over
- You receive configuration documentation, a key custodian runbook and the unlock sequence written for your own operations staff.
- We provide test records and the evidence list agreed during scoping, so your internal and external reviewers can trace each control to a result.
- We walk your platform and security teams through the runbooks, including the procedure for replacing a custodian who leaves.
How we support
- Ongoing support, upgrades and continuous testing are available as a retainer, which covers Hyperswitch release changes that affect the key storage layer.
- Retainer scope is agreed in writing, so you know which HSM, key rotation and audit tasks are included and which need a new engagement.
- Where a Hyperswitch upgrade changes the vault or encryption service, we retest the HSM path before you roll the change into production.

