Skip to the content.

TPM

Deadline: Wednesday, 5/7/2025. Submit the report in HuskyCT.

In this project, we experiment with TPM.

We will first follow the course from the following repo. There are detailed instructions in files under docs directory.

TPM 2.0 Courses

The list of tutorials in the course is in the docs folder.

List of tutorials

The manual of TPM2 commands is on the following page.

TPM2 tools manual

Environment Setup

This project is intended to run in a Linux environment. If you’re using Windows, please follow the instructions below step-by-step. For Linux/Ubuntu users, you can start directly from Step 2. For macOS users, while I haven’t tested it personally, you may also begin from Step 2. If you encounter any issues, try starting from Step 1.

Step 1: Install Ubuntu in a Virtual Machine.

We already installed a Virtual Machine in previous projects, we can reuse it. Then follow these steps to install Ubuntu in the Virtual Machine.

Step 2: Install Docker and Set Up the TPM Environment.

The environment for TPM is in a docker container. Once Ubuntu is up and running (either natively or in a virtual machine), follow the instructions under the “Installation” section in the TPM 2.0 Courses GitHub repository. These steps will walk you through installing Docker and configuring the TPM environment required for the project.

If you are not familiar with docker, please see docker.md for details. Be careful about removing containers. A container can be stopped and resumed. However, if you delete a container, all files in that container will be lost.

Here are some commonly used commands, assuming the container’s name is tpm.

docker run --name tpm -it tpmcourse:latest
docker start tpm
docker exec -it tpm bash
docker stop tpm

We can restart the TPM with the shell script tpm2restart.sh.

Tasks

Task 1 Set up the environment and generate random bytes

After setting up the docker container, study the tutorial in random.md.

Include the following tasks in your report.

Task 2 Experiment with objects

Study the tutorial and try the commands in objects.md.

Clear all passwords before working on later tasks (so we do not need to enter passwords). To clear a password, just leave the new password empty.

Include the following tasks in your report.

Task 3 Keys and encryption/decryption/signing/verification

Study the tutorial and try the commands in key.md. Skip the “Loading External Keys” section. There is an important section after it.

The command to remove an object by handle is as follows. The command in the tutorial misses -c.

tpm2_evictcontrol -c 0x81010004

We do not have to make a key persistent. We can use the context file in place of a handle.

When making a key persistent with tpm2_evictcontrol, we do not have to specify a handle. The first handle available will be used if the command line does not have a handle.

Include the following tasks in the report.

Task 4: Quoting

Study the tutorials and try the commands in pcrs.md and quoting.md.

We will use PCR 23 in SHA1 bank.

Include the following tasks in the report.

Task 5: Sealing and unsealing

Now we experiment with sealing secret with key and measurements.

Deliverables

Submit a PDF file that includes commands you used in each Task and the results in screenshots.