---
title: "Notary-backed vTPM"
description: "A software TPM for VMs and containers whose state is sealed by the host's hardware, whose seed and attestation key live there, and whose certificates chain to the host notary. Served by swtpm-notary, a patched swtpm."
source: "EQTY Notary"
---
A notary-backed vTPM is an [swtpm](https://github.com/stefanberger/swtpm) instance that the
[Desktop Notary](../desktop-notary/index.mdx) creates, provisions and runs, with its secrets kept
in the host's hardware root of trust: the TPM on Linux, the Secure Enclave on macOS. A VM boots on
it and sees an ordinary TPM. A verifier holding the host notary's DID can check that a quote from
that VM was signed by a key only the host's hardware can use.

What makes it hardware-rooted is where its secrets live:

- **Its state is sealed by the host root.** The state file is encrypted with a key the host TPM
  seals, or the Secure Enclave wraps on macOS. It cannot be started on another machine, and a
  copied state directory is useless.
- **Its endorsement seed is derived, never stored.** The seed the EK is derived from comes from
  the host root at every start and is zeroed in the state file. The same vTPM on the same host
  always yields the same EK; a copied state has no EK at all, and stock libtpms refuses to load
  it.
- **Its signing keys are hardware keys.** In `identity` mode, the IAK and any AK created under
  the endorsement hierarchy are `fixedTPM` keys in the host TPM, or Secure Enclave keys on macOS.
  swtpm holds only an opaque key ID and forwards each signature to the notary *after* libtpms
  has done all of its authorization and restriction checks, so TPM semantics, key names and
  session HMACs are unchanged for clients.
- **Its certificates chain to this notary.** The EK and IAK certificates are issued by the notary
  AK on Linux or the notary system key on macOS, and written into the vTPM's NV at the TCG
  indices, with the issuer chain beside them.

The trust claim is "a vTPM whose keys and seed are held by this host's TPM or Secure Enclave,
served by swtpm with hash `H`", not "a TPM". Authorization, the `restricted` attribute and what
gets measured into the vTPM's PCRs remain software decisions made by libtpms in host memory.
Someone who controls the host can use a backed key while they keep that control; they can never
take it away.

## How it works

1. The host notary creates a vTPM: it seals a state key in the host root, starts an swtpm-notary
   instance with the hardware-derived seed and the address of its own socket, provisions the EK
   and IAK, and writes their certificates and its own chain into the vTPM's NV.
2. A VM attaches to the vTPM's control socket, through QEMU's TPM emulator backend or, on Apple's
   Virtualization.framework, a vsock driver. The guest sees `/dev/tpm0` and `/dev/tpmrm0`, and
   its firmware and kernel measure into the vTPM from the first instruction.
3. When libtpms needs the seed, creates a key that should be backed, or signs with one, swtpm
   forwards the request to the notary over a Unix socket. The notary identifies the calling
   swtpm by its PID, which must be a child it launched, and answers from the host root.
4. A notary inside the guest treats the vTPM as its hardware TPM. It has the IAK certify its AK
   and carries the vTPM's chain in its identity credential, so a manifest from a container in the
   guest chains, through the vTPM, to the host's hardware.

```mermaid
flowchart LR
    subgraph host["Host"]
        HW["TPM 2.0 or Secure Enclave"] --- N["eqty-notary"]
        N -- "seed, keys, signatures" --- S["swtpm-notary<br/>--eps --extkey"]
    end
    subgraph vm["VM"]
        T["/dev/tpmrm0"] --- G["guest eqty-notary"] --- C["containers"]
    end
    S -- "control socket" --- T
```

## swtpm-notary

The emulator is swtpm and libtpms v0.10.2 with two additions, kept as a reviewable patch series:
an external endorsement seed, so the seed comes from the notary and is never written, and
hardware-held signing keys, so the IAK and AKs are created in the host root and only a key ID
stays in software. Without those two options the build behaves exactly like upstream. It ships
as a `.deb` and a `.pkg` that install to `/opt/eqty/swtpm-notary`, where the notary looks first.
See [Install swtpm-notary](./install.mdx), and under Advanced Topics the
[socket protocol](./advanced/protocol.mdx), the [patches](./advanced/patches.mdx) and the
[release compatibility](./advanced/compatibility.mdx).

## What you need

- A notary from 0.0.5 on Linux (TPM backend) or macOS. From 0.0.7, vTPMs are hardware-rooted by
  default when the fork is installed, and a vTPM's owner can start and inspect it without sudo.
  0.0.8 adds seed epochs, bound signing and key release to the socket protocol.
- The swtpm-notary package. With stock swtpm the notary still runs vTPMs, but with the seed
  stored and the keys in software.

## The pieces

| Piece                     | What it does                                                                                       | More                                                       |
| ------------------------- | -------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
| **Host notary**           | Creates, runs and crypto-shreds vTPMs; holds their seeds and backing keys in the host root.        | [Desktop Notary](../desktop-notary/index.mdx)              |
| **swtpm-notary**          | The patched emulator that asks the notary for its seed and forwards signatures.                   | [Install swtpm-notary](./install.mdx)                      |
| **`eqty-notaryctl vtpm`** | Create, list, show, start, stop and delete vTPMs; print their certificates.                        | [Command Line](../desktop-notary/advanced/cli.mdx#vtpms)   |
| **Guest notary**          | The Linux notary `.deb` running in the VM on the vTPM, issuing credentials for the VM's processes. | [Run a Guest Notary](./guest-notary.mdx)                   |

## Get started

1. [Install swtpm-notary](./install.mdx) next to the notary. New vTPMs are then hardware-rooted
   by default.
2. [Create a vTPM](./create-a-vtpm.mdx) and attach it to a QEMU VM.
3. [Run a guest notary](./guest-notary.mdx) on it and verify the chain back to the host.

The design document, `docs/VTPM.md` in the vcomp-notary-desktop repository, has the full threat
model and what is still open: the EK is still a software key with a hardware-derived seed, host
PCRs are not yet in the backing-key policy, and there is no `VCompVTpmV1` credential type yet.