Healthcare
Discuss prevalent matters regarding healthcare topics
23 Discussions

Unlocking Healthcare Security: Hands-On with Trusted Platform Module (TPM) Technology

Andrew_Lamkin
Employee
0 0 1,962

Introduction

In this post, we’ll dig in and interact with your own local Trusted Platform Module.

Note: If you don’t have access to a TPM-enabled computer, or the right admin privileges, Google hosts a fantastic TPM simulator here that exercises Intel TPM2 Software Stack, IBM TPM Simulator, and Google BoringSSL to create a great virtual platform for learning.

 

TPM First Contact (Windows)

The Microsoft Windows operating system relies on TPM-based capabilities for security components including BitLocker™ drive encryption, the Virtual Smart Card features, and the Crypto Provider. Windows 10 and 11 actually require TPM 2.0 to be enabled in ALL desktop and server editions. Measured Boot, enabled by the system’s TPM paired with remote attestation, secures the system configuration against rootkits and similar attacks that would otherwise be undetectable. 

 

We can quickly check some details of the TPM on our Windows system by heading into the Device Manager screen and looking for the Security Devices section.

Andrew_Lamkin_0-1710879371814.png

 

Let’s interact with it. Open a terminal window, and let’s get some basic information out of the system. Windows provides several powershell cmdlets that can be used immediately.

 Get-Tpm returns a set of info from the module like below:

Andrew_Lamkin_2-1709932903178.png

We can also infer a bit about the system underneath using this information: For example, the manufacturer field here will read "Intel" if the platform is equipped and using Platform Trust Technologies (PTT). In this case it's using a TPM from the manufacturer STM.

 

Get-TpmEndorsementKeyInfo -Hash "Sha256" can be used to get info about the endorsement public key and certs:

Andrew_Lamkin_3-1709932909930.png

 

If that was fun, explore some of the other user-space operations here. Notice that most of these are about TPM information or ownership. 

 

To use the TPM from an application perspective, we need to interact with the Windows Core Security features, specifically the TPM Base Services software component and associated API. Microsoft provides wrappers and utilities to help speed the integration of these operations here

and we'll start exploring these next.

 

TPM First Contact (Linux)

Storing and loading keys using a TPM in Linux is enabled using a set of standardized commands and libraries that make it possible to work with keys securely across any TPM 2.0 compatible module. 

Checking to see if a TPM is present in the system can be done at a high level by simply looking through the system log with: dmesg | grep -i tpm

 

Here's a step-by-step to some basic interactions on a Linux system:

  1. Prerequisites:
    • Ensure you have a TPM 2.0 chip installed on the target system.
    • Install the necessary TPM 2.0 software packages. These packages may vary depending on your Linux distribution. Common packages include tpm2-tools and tpm2-tss.
  2. Initialize the TPM:
    • Before using the TPM, initialize it if it hasn't been done already. You can use the tpm2_startup command to initialize the TPM.
  3. Create an Application Key:
    • Generate an application-specific key that you want to store in the TPM. You can use a software library like OpenSSL or a TPM library like tpm2-tools to generate this key.
    • For example, you can generate an RSA keypair: openssl genpkey -algorithm RSA -out appkey.pem
  4. Load the Key into the TPM:
    • Use the TPM 2.0 tools to load your application-specific key into the TPM. You will typically use the tpm2_load command for this purpose: tpm2_load -C context.out -u appkey.pub -r appkey.priv
    • This command loads the key into the TPM and saves its context in the context.out file. You will need this context to use the key later.
  5. Use the TPM-Resident Key:
    • When your application needs to use the key, you can use TPM commands or libraries like tpm2-tss to perform cryptographic operations with the TPM-resident key. For example, if you want to sign data with the TPM key: tpm2_sign -c context.out -g sha256 -m data.txt -s signature.bin
    • This command signs the data using the TPM-resident key and saves the signature in signature.bin.
  6. Unload the Key (Optional):
    • If you no longer need the TPM-resident key, you can unload it from the TPM using the tpm2_flushcontext command: tpm2_flushcontext -c context.out
    • This frees up TPM resources associated with the key.
  7. Shutdown and Cleanup (Optional):
    • After your application is done using the TPM, you can shut down the TPM using the tpm2_shutdown command. 

Now we’re putting the TPM to work! Note that while the loaded key does benefit from the built-in protections that the TPM offers (see Table: TPM Feature Breakdown in the last blog here), it’s otherwise unguarded. 

 

What's Next?

In the next article, we will be creating policies to seal, protect, and extend the root of trust.

 

Reach out to Intel's Health and Life Sciences team at health.lifesciences@intel.com or learn more about security features at https://www.intel.com/health.

 

About the Author

Andrew Lamkin is a Health Security-focused AI Solutions Architect at Intel Health & Life Sciences, where he applies his background in mission-critical computing from the defense and aerospace industries to build a foundation for trusted computing in healthcare. 

 

Links and Resources

Google’s TPM simulator: Intel TPM2 Software Stack, IBM TPM Simulator, Google BoringSSL

Trusted Computing Group’s resources on TPM 2.0

Microsoft’s Overview of TPM with Windows

Windows TPM Simulator

Guide to TPM use in RTI DDS software for key storage