Skip to content

Commit 7b989e2

Browse files
committed
add example usage
1 parent 10057bb commit 7b989e2

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

  • content/blog/tpm-startup-and-provisioning

content/blog/tpm-startup-and-provisioning/index.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,3 +551,36 @@ From the TPM’s perspective, a “normal” provisioning flow looks roughly lik
551551
- `TPM2_CreatePrimary(parent = 0x40000001)`.
552552
- Use that key as a parent for children:
553553
- `TPM2_Create`, `TPM2_Load`, etc.
554+
555+
## 5. A Concrete Example: Signing Data with a TPM
556+
557+
Everything above can feel abstract until you actually use a TPM for something real.
558+
559+
To make this concrete, I’ve put together a small sample project that walks through a complete, minimal TPM signing flow using [TSS](https://tpm2-tss.readthedocs.io/en/latest/index.html):
560+
561+
👉 [TPMSign](https://github.com/DavisRayM/tpm-sign)
562+
563+
### What the Project Demonstrates
564+
565+
The project shows how to:
566+
567+
1. Initialize and verify TPM state
568+
- Assumes the TPM has completed `_TPM_Init()` and `TPM2_Startup`.
569+
- Verifies that a usable storage hierarchy exists.
570+
2. Create (or reuse) a primary key
571+
- Uses `TPM2_CreatePrimary` under the storage hierarchy (0x40000001).
572+
- Produces a transient handle in the 0x8000_0000 range.
573+
3. Create a signing key under that primary
574+
- Uses `TPM2_Create` + `TPM2_Load`.
575+
- The private portion of the key never leaves the TPM.
576+
4. Sign user-supplied data
577+
- Hashes the input message
578+
- Uses `TPM2_Sign` to generate a signature inside the TPM.
579+
- Returns a standard RSA signature that can be verified outside the TPM.
580+
581+
At no point does the signing key’s private material leave the TPM — all
582+
cryptographic operations are bound to TPM handles, exactly as described earlier
583+
in this post.
584+
585+
If you understood the annotated command dumps in this post, the project should
586+
feel familiar — it’s the same flow, just applied to a practical task

0 commit comments

Comments
 (0)