Use a TPM when the key must stay tightly bound to a single device, such as boot integrity or local disk encryption. Use an HSM when many applications or systems need stronger key protection, broader cryptographic support, or better performance at scale. The practical decision is whether you need device-level trust or centralized key control.
Choosing the right trust boundary for cryptographic keys
TPM and HSM solve different parts of the same problem: protecting keys from exposure while preserving controlled use. A TPM is usually the better fit when the security value is tied to one machine, especially for platform trust, boot measurement, or local encryption keys that should not leave the device. An HSM becomes the stronger choice when the key must serve shared systems, higher throughput, or more demanding cryptographic operations.
The key question is not which device is “more secure” in the abstract, but where the trust boundary must sit. TPMs are designed to anchor trust to hardware on a specific platform, while HSMs are built to centralise key custody and expose cryptographic operations through a protected interface. That difference matters most when you need portability, scale, or multi-application governance.
For key management practice, the decision should align with the key’s lifecycle and blast radius. NIST’s key management guidance stresses that key protection has to match the key’s purpose, lifetime, and operational context, and the same principle is reflected in the practical split between local hardware root of trust and centralised key service. For the broader governance view, NIST SP 800-57 Key Management is the most useful baseline.
Where TPM and HSM differ in operational reality
A TPM is generally embedded in the device and is strongest when the security property depends on that exact platform. It is well suited to sealing secrets to a machine state, supporting secure boot, and protecting local credentials or disk keys so they are only usable when the system is in the expected condition. If the key never needs to be shared broadly, the TPM’s narrower scope is often an advantage.
An HSM is the better fit when keys must be used by multiple hosts, applications, or services, or when the organisation needs stronger central control over generation, storage, rotation, access policy, and auditability. HSMs also tend to be preferred when cryptographic throughput, key isolation for high-value workloads, or compliance-driven custody requirements outweigh the simplicity of device-bound trust.
There is also a practical difference in failure handling. With TPM-backed keys, replacement or reimaging can make recovery and migration more complex because the key is coupled to the hardware and its state. With HSM-backed keys, the operational challenge shifts toward availability, quorum, backup, and access control around a shared cryptographic service. In both cases, the team should treat recovery design as part of the decision, not as an afterthought.
For a threat-oriented perspective on what happens when keys are exposed or extracted, the contrast is visible in incident patterns such as Microsoft Azure Key Breach and AI LLM hijack breach, where key compromise changed from a local secret problem into a broader trust and access problem.
Risk and Threat Considerations
The main risk is choosing a protection boundary that is narrower or broader than the key’s actual use. A TPM can leave teams with a key that is well protected on one host but awkward to scale or recover, while an HSM can become a high-value shared dependency if access controls, network segmentation, or operational governance are weak.
Failure mechanism: TPM risk rises when teams assume device binding alone is sufficient, even though the real exposure comes from key reuse patterns, poor recovery design, or secrets that still leave the device in surrounding workflows. HSM risk rises when centralisation makes the service a concentration point for privilege, availability, and administrative abuse.
Impact: The wrong choice can lead to key theft, service outage, failed rotation, or an overly broad trust blast radius. At scale, that can turn a single cryptographic control into a cross-system dependency that is hard to audit, hard to rotate, and expensive to recover.
In environments with weak secret hygiene, the broader organisational risk often dominates the hardware choice. NHI research shows that exposed or long-lived secrets remain a recurring cause of compromise, and the most relevant signal here is that 96% of organisations store secrets outside dedicated managers in vulnerable locations such as code, config files, and CI/CD tools.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
NIST SP 800-63, NIST CSF 2.0 and CIS Controls v8 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| NIST SP 800-63 | 1.1 — Digital Identity Model | Key custody and authenticators must match the trust relationship the key supports. |
| Recommendation — Align key protection to the identity assurance level and authenticator type the workload actually needs. | ||
| NIST CSF 2.0 | PR.AC-1 — Identity Management, Authentication, and Access Control | Key access and custody depend on controlled access paths and governance. |
| PR.DS-1 — Data-at-Rest Protection | TPM and HSM are both used to protect sensitive cryptographic material at rest. | |
| Recommendation — Restrict who and what can use cryptographic keys through explicit access control. Protect keys at rest with hardware-backed controls matched to their operational scope. | ||
| CIS Controls v8 | 6.3 — Secure Authentication and Access Control | Hardware key protection is part of controlling access to sensitive credentials and secrets. |
| Recommendation — Use stronger access controls for key material that can authorize critical systems. | ||
Practitioner Guidance
What to verify: Confirm whether the key is truly single-device, single-purpose material before choosing TPM. If the key must be consumed by multiple systems, by automation, or by a shared platform control plane, treat that as an HSM use case even if the workload started locally.
Decision rule: If the key’s security value depends on machine-specific trust, prefer TPM; if the key’s value depends on central custody, policy enforcement, and scale, prefer HSM. Do not choose based on “stronger hardware” alone, because the right answer is usually the smaller blast radius for the real deployment pattern.
What practitioners underestimate: Migration and recovery are often the hard part. Teams frequently optimise for protection at rest and then discover that restore, failover, rotation, and key escrow are where the architecture either holds up or breaks down.
Practitioner takeaway: The best choice is the one that matches how the key will actually be used, recovered, and governed, not the one with the broadest reputation for security.
Related resources from NHI Mgmt Group
- How should security teams choose between API keys, Device Flow, and Client Credentials for CLI apps?
- How should security teams choose between SMS MFA, authenticator apps, and security keys?
- How should security teams choose between monitoring tools that focus on infrastructure, behavior, and code-to-cloud coverage?
- How should security teams implement HSM integration in environments that rely on sensitive cryptographic keys?
Deepen Your Knowledge
Reviewed and updated by the NHIMG editorial team on September 20, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org