Hyperledger Fabric with AWS CloudHSM: when a network needs HSM-held MSP keys
A regulated Fabric operator whose security team requires signing keys in hardware has to move the peer and orderer MSP private keys out of the file system and into an HSM. Fabric supports this through the PKCS#11 standard, and AWS CloudHSM is one target that teams use for it. The Fabric-specific step that most often trips up deployments is the AltID parameter. When AWS HSM is used, AltID must be added to the pkcs11 section of the bccsp block so that each key gets a unique Subject Key Identifier, and the value should be a long secure string created outside Fabric. Treat that string as a secret with its own storage and rotation plan, not as a configuration value to paste into a file.
The HSM protects only the MSP signing keys. TLS keys remain file-based, so the TLS material for peers, orderers and the operations service still lives on disk and needs the same protection plan as any other server certificate. The prebuilt Fabric Docker images are not built with PKCS#11 support, so the team must build and maintain custom images that include the PKCS#11 library and the CloudHSM client components. Confirm with your AWS account team and the current Fabric HSM documentation which client library version and configuration your CloudHSM cluster requires before you commit to an image build.
Before the build starts, decide where the HSM sits in your key lifecycle. Ask who creates and backs up the CloudHSM users, how the library path and PIN reach the container without landing in images or plain Kubernetes secrets, and how a replaced or cloned node keeps a unique Subject Key Identifier. Plan a test on a non-production network first, because a key that is already in the HSM cannot be simply exported back to a file. Those decisions shape the effort of the rollout far more than the Fabric configuration file itself.
Configuration choices for Fabric with CloudHSM and when each fits
This table compares the main configuration decisions for running Fabric MSP keys in AWS CloudHSM, including library packaging, AltID assignment and how far HSM protection extends. Read each row as a choice you make once, with the operational cost it carries after go-live.
| Decision | Option and what it means | When it fits and what it implies for operations |
|---|---|---|
| Image and library packaging | Custom PKCS#11-enabled image with the CloudHSM client library mounted, because the prebuilt Fabric Docker images are not built with PKCS#11 | Fits any production network that must keep signing keys in CloudHSM. You own image builds, rebuilds on each Fabric patch release, and vulnerability scanning of the custom image. |
| Image and library packaging | File-based MSP keys with no HSM, using standard Fabric images | Fits test networks or lower-sensitivity deployments where your key-protection policy accepts file-based signing keys. Simpler upgrades, but assessors will ask how the key files are protected at rest. |
| AltID value | A unique AltID per node, generated outside Fabric as a long secure string | Fits networks where several peers or orderers share one CloudHSM cluster. Each node's Subject Key Identifier stays distinct, but you must record and back up each value alongside its node configuration. |
| AltID value | A shared AltID across nodes | Generally a poor fit for multi-node setups, since the Fabric HSM guidance requires a unique Subject Key Identifier. Confirm the constraint against the current Fabric HSM documentation before choosing any shared scheme. |
| Key scope in the HSM | Signing keys only (peer and orderer MSP signing keys), with TLS keys kept on disk | Fits most designs, since the Fabric HSM guidance keeps TLS keys file-based. Operations focus on protecting the file-based TLS material with Kubernetes secrets or encrypted volumes. |
| Key scope in the HSM | Wider scope that tries to move TLS or other key material into the HSM | Not supported by the Fabric guidance for TLS keys. Treat any broader scope as a design change to validate with the Fabric project and your HSM vendor before you commit. |
| Key lifecycle | Keys generated in CloudHSM and imported or referenced by Fabric, with a documented rotation and recovery plan | Fits organizations that need evidence of key custody. Expect ongoing work for certificate renewal, key immutability checks and restore testing for the HSM and the CA database. |
Setup sequence for Fabric MSP keys in AWS CloudHSM
This sequence moves Fabric peer and orderer MSP signing keys into AWS CloudHSM while keeping TLS keys and the rest of the MSP material file-based, with a check at each stage so the keys are proven to live in the HSM before the network depends on them.
Plan the CloudHSM cluster and client
Your cloud team creates the CloudHSM cluster and client instances in the same network as your Fabric nodes, and the Fabric team records which peers and orderers will use it, which crypto user will own the keys, and how the partition password will be stored. Confirm current cluster sizing, networking and client requirements with AWS before you commit, because those details change over time. Done means you hold a written inventory of cluster, client hosts, crypto users and the nodes that will sign with HSM keys, and the client host can reach the cluster.
Build a PKCS#11-enabled Fabric image
Your platform team builds custom peer and orderer images, because the prebuilt Fabric Docker images are not built with PKCS#11 support. The build must include the CloudHSM PKCS#11 library in a form the container can load, and it should be tagged with a version that ties it to a specific Fabric release. Done means a test container starts with the HSM-enabled image and reports the PKCS#11 provider as loaded in its logs, without changing any MSP keys yet.
Mount the CloudHSM client library and configuration
Your platform team mounts the CloudHSM client library, its configuration and the crypto user credentials into the peer and orderer containers, using read-only mounts or Kubernetes secrets where the credentials are kept outside the image. Keep the mounted paths consistent across all nodes so that configuration is identical everywhere. Done means each container can authenticate to the cluster as the crypto user and list the cluster's keys with the vendor's tooling, and the TLS key files remain on the file system as Fabric requires.
Add the AltID parameter with a secure string
The Fabric team adds the AltID parameter to the pkcs11 section of the bccsp block in each node's core.yaml or orderer.yaml. The value is a long, secure string generated outside Fabric, such as by a password manager or a secrets tool, and it gives each HSM-backed key a unique Subject Key Identifier. Record the value in your secrets store and give every node a distinct value. Done means each node starts with the bccsp block loaded and the value is absent from version control.
Enroll identities so keys generate in the HSM
The Fabric team enrolls the peer and orderer identities through Fabric CA with the HSM-enabled configuration, so the signing key pairs are generated inside the HSM rather than written to the msp keystore directory. Enroll each identity once, in a test channel environment first, because a key generated in the wrong place cannot be moved later. Done means the keystore directory holds no private key file for the enrolled signing identity and the HSM lists a new key for it.
Verify signing and operational health
The Fabric team starts the node, submits a test transaction or channel configuration signed by the HSM-backed identity, and confirms the signature validates against the MSP certificate. They also check the operations service endpoints, such as /healthz, to confirm the node reports healthy and the logs show no fallback to file keys. Done means a signed transaction is accepted by the network, the health check passes, and the logs confirm the HSM provider is in use.
Confirm what remains file-based and document it
Your security and Fabric teams write down which material stays on disk, including TLS keys, the TLS certificate chain, the public MSP certificates and configuration files, and how each is protected through encrypted volumes or secrets. Ask your HSM support contact and your auditors to review this record before production traffic. Done means a signed document lists every key location, its owner, its protection and the test evidence from the previous steps.
What remains file-based when AWS CloudHSM protects MSP keys
Moving MSP signing keys into AWS CloudHSM does not move everything. TLS keys, operations service certificates, MSP certificates and configuration, ledger data and the custom image all stay on disk or in files, so each needs its own protection plan.
TLS keys stay on disk
Peer and orderer TLS private keys remain file-based because Fabric's PKCS#11 support covers the MSP signing keys held in the bccsp block, not the TLS stack. Every node therefore still has a TLS key file that an attacker with node access could read. Restrict file permissions on the key directory, keep it off shared volumes, and plan rotation through your certificate process. Confirm the current scope of PKCS#11 support against the HSM docs before you rely on it.
Fabric HSM docsOperations service certificates
The operations service exposes health, log level, version and metrics endpoints secured with mutual TLS client certificates. Its server certificate and the list of client root CAs are file-based, so they sit outside the HSM even when signing keys do not. Anyone who can change the log level or read metrics needs a controlled client certificate. Check which identities can reach these endpoints and where their certificates are stored.
MSP certificates and configuration
The HSM protects private keys, but the MSP directory still holds signed certificates, the CA chain, admin certificates and config.yaml. These files are not secret in the same way, yet altering them can change which identities a node trusts. Keep them under version control or integrity checks, limit write access to operators, and record every change. Verify the MSP contents match what the channel configuration expects after each update.
Ledger data on peers and orderers
Block files and state databases are not encrypted by the HSM. Anyone with access to the peer file system or the orderer storage volume can read transaction data, even without the signing keys. Decide whether volumes are encrypted at the storage layer, where backups go, and who can restore them. Your backup of the ledger and MSPs is only as protected as the storage it lands on.
Custom image and library mount
The prebuilt Fabric Docker images are not built with PKCS#11, so you need a custom image that includes the library, and the library and the AltID value must be mounted or supplied at runtime. The library file, its configuration and the AltID string are all outside the HSM boundary and must be controlled like secrets. Pin image digests, scan the build, and confirm the library version against your CloudHSM client version before each upgrade.
PKCS#11 setup notesQuestions buyers ask before moving Fabric keys into AWS CloudHSM
What does moving Fabric keys into AWS CloudHSM cost, and what drives the effort?
No price is published here, and the cost depends on the written scope. The main cost is skilled engineering time spent on three areas: building custom PKCS#11-enabled peer and orderer images, configuring the AltID value and the pkcs11 section of the bccsp block on every node, and proving that signing still works on each organization's peers and orderers. Effort rises with the number of peers and orderers, the number of organizations, how many environments (development, test, production) need the same setup, and whether your current networks already run on a supported Fabric release. Ask any provider for a quote that lists each node type, each environment, the image build and the test plan as separate line items, along with what is one-time and what recurs.
How long does a pilot take, and what sets the duration?
Duration depends on the number of nodes in the pilot, how much of the environment is already built, and how quickly the CloudHSM cluster, network access and credentials become available. A useful pilot covers one peer and one orderer from each organization that will hold keys, runs the full enroll, sign and transaction path, and ends with a documented rollback. Start by confirming with your CloudHSM administrators the cluster sizing, the crypto user setup and the network path from your Kubernetes or VM hosts. Those inputs usually set the schedule more than the Fabric configuration does. Agree on a timeline only after those inputs are confirmed in writing.
What must our internal team provide before the work starts?
Your team needs to provide access and decisions, not just a request. The main items are:
- An AWS account structure with a CloudHSM cluster and HSM users that the Fabric nodes can authenticate as.
- A secure source for the long string used as the
AltIDvalue, created outside Fabric and stored in your secrets system. - Network paths between the Fabric nodes and the HSM cluster, plus your container registry for the custom images.
- Named owners for the Fabric CA, the MSP lifecycle and the change approval process.
- Test networks where key rotation and node replacement can be rehearsed before production.
Confirm the exact setup with your AWS and Fabric administrators, because the requirements depend on your cluster and deployment model.
Can our own team do this without outside help?
Yes, a capable platform team can do this without an outside partner, provided it has engineers who know Fabric MSP and BCCSP configuration, Kubernetes or your deployment platform, and AWS CloudHSM administration. The steps are well documented in the Fabric HSM guidance, which describes the PKCS#11 setup and the rule that TLS keys stay file-based. The risk is less about the first build and more about the first incident: a wrong AltID, a lost HSM user or an image that was not rebuilt after a Fabric upgrade can block signing across a network. Decide early whether your team will own the runbooks, the test evidence and the upgrade path, and whether outside help is needed for that part alone.
How does testing with SoftHSM fit into the rollout?
SoftHSM is a software PKCS#11 token, and it lets engineers test the PKCS#11 configuration, image build and key-handling flow before any CloudHSM cluster is used. It is useful for proving that the peer or orderer starts, reads the pkcs11 settings and signs transactions in a non-production environment. It does not prove that AWS CloudHSM behaves the same way, so the AWS HSM tests must still run on a real cluster before production. Plan the SoftHSM stage as the first gate, then repeat the same test cases against CloudHSM, including startup, signing, a node restart and a key-immutability check. Record results for each gate so auditors and internal reviewers can trace what was tested and where.
What recurring work follows after the keys are in CloudHSM?
Recurring work is ongoing and falls into four areas: rebuilding custom peer and orderer images whenever Fabric is upgraded, since the prebuilt Docker images are not built with PKCS#11; checking that Fabric releases on your line still behave the same with the HSM configuration; keeping HSM users, cluster capacity and backups under review; and rehearsing recovery for lost or replaced nodes. Fabric has a 3.x line and a 2.5 LTS line that both receive patch releases, so your image pipeline must track whichever line you run. Ask any provider to define these tasks, their owners and their frequency in the scope, and to state whether support for them is a retainer or a separate engagement.
Which parts of the key material stay file-based?
TLS keys must remain file-based, so only the peer and orderer MSP signing keys move into the HSM. The Fabric HSM documentation is explicit on this point. Your team still needs a secure file store for TLS keys, a plan for their rotation and a way to protect the volumes that hold them. The practical question is how the TLS material and MSP configuration are mounted, backed up and restricted inside your cluster. Confirm this boundary with your security team and record it in your key inventory so reviewers can see which keys sit in the HSM and which do not.
How DeployOpen scopes and delivers Fabric HSM key protection
DeployOpen plans, builds and hands over Hyperledger Fabric peer and orderer deployments that keep MSP signing keys in AWS CloudHSM, inside infrastructure the client controls. The work is scoped in writing first, then built, tested and documented so the client's security and operations teams can review and run it.
How we scope
- Inventory every peer and orderer identity and confirm which MSP keys will move into AWS CloudHSM and which stay on disk.
- Confirm the AWS CloudHSM cluster, network path, crypto user model and who holds the credentials used by Fabric nodes.
- Agree the written scope, deliverables and timeline before work starts, since most engagements are fixed-scope.
How we build
- Configure the bccsp pkcs11 section with the AltID parameter, using a long secure string created outside Fabric, and verify unique Subject Key Identifiers.
- Build custom peer and orderer images with PKCS#11 support, because the prebuilt Fabric Docker images do not include it.
- Test key generation, signing, restart behavior and TLS separation in a non-production environment before any production cutover.
How we hand over
- Deliver configuration files, image build records and a runbook covering the CloudHSM library mount and the file-based TLS material.
- Document which secrets remain file-based, how they are protected, and how MSP material is backed up under the Fabric upgrade steps.
- Walk the client's security and platform teams through the evidence so they can review the setup against their own controls.
How we support
- Plan upgrades of Fabric binaries and custom images together, checking PKCS#11 compatibility against each target release.
- Offer ongoing support, upgrades and continuous testing as a retainer after handover, scoped in writing.
- Confirm with the client which HSM, library and Fabric version changes need retesting before they reach production.

