Skip to content

safekeys/hardware-root [planned] ​

Phase 1 hardening moves the long-term key share out of ordinary RAM and into a hardware root of trust. Options are ordered cheapest first — existing TPM 2.0, cloud confidential computing, a USB token or discrete secure-element dongle (~$15–35), or a soldered secure element ($1–3 chip). The sidecar talks to the device; the LLM never does. Devices can be factory-provisioned and drop-shipped.

Status: planned

Why this exists ​

In the software-only MVP the promise holds architecturally, but a rooted host can still attack the sidecar's memory. Hardware moves the key to a boundary an operating-system compromise cannot cross, and because the agent-facing API does not change, customers adopt it without rewriting anything.

Design decisions ​

cheapest-option-first [accepted] ​

Decision: Order hardware options cheapest first: TPM 2.0, cloud confidential computing, USB token or dongle, soldered secure element.

Rationale: TPM 2.0 exists in most enterprise hardware at no extra cost and confidential computing needs no physical device, so the first hardening step can be free. Physical devices are reserved for environments that need them.

drop-shipped-provisioning [accepted] ​

Decision: Support factory-provisioned devices that are drop-shipped to customers.

Rationale: Provisioning identity, an attestation key, and a locked applet before shipping makes deployment plug-and-play and enables the hardware business line in the open-core split.

no-custom-silicon-day-one [accepted] ​

Decision: Do not require custom silicon for the MVP or Phase 1.

Rationale: The blueprint's non-goal is explicit — requiring bespoke silicon on day one would block adoption of a product whose software phase already delivers the core promise.

How it works ​

Bind a hardware root to an environment (bind-device) ​

A device is provisioned and bound to customer policy on first plug-in.

  1. Setup — Device is factory-provisioned with identity, an attestation key, and a locked applet.
  2. Authenticate — First plug-in performs mutual attestation between the device and the key authority.
  3. Validate — The binding is recorded against customer policy in the control plane.
  4. Observe — The sidecar now performs unwrap operations through the device.

Unwrap through the hardware boundary (unwrap-via-device) ​

The device performs or gates the unwrap so key material never enters host RAM.

  1. Send — Sidecar sends the unwrap request to the device.
  2. Validate — The device checks that the request is authorised by policy and device state.
  3. Observe — The long-term share never leaves the device boundary.
  4. Delete — The device zeroises transient material and any tamper response wipes state.

Revoke a lost device (revoke-device) ​

A lost or stolen device is revoked by serial.

  1. Receive — Operator revokes the device serial at the authority.
  2. Record — The binding is invalidated and the revocation is audited.
  3. Observe — Attestation fails for that device on any subsequent unwrap attempt.

Flow Diagrams ​

mermaid
sequenceDiagram
    participant User
    participant Browser
    participant IdP
    participant IdP as Identity Provider

    Note over Server,Browser: setup — Device is factory-provisioned with identity, an attestation key, and a locked applet.
    Browser->>IdP: OIDC flow — First plug-in performs mutual attestation between the device and the key authority.
    User->>Browser: validate The binding is recorded against customer policy in the control plane.
    Browser-->>User: shows The sidecar now performs unwrap operations through the device.

Guarantees ​

key-not-in-host-ram ​

In the hardware phase the long-term share must not exist in general-purpose host memory.

Acceptance criteria:

  • [ ] Unwrap occurs at or behind the device boundary
  • [ ] The sidecar never receives the long-term share
  • [ ] An OS-level compromise cannot extract the share

agent-api-unchanged ​

Adding hardware must not change the agent-facing interface.

Acceptance criteria:

  • [ ] Tokens and folders are unchanged
  • [ ] No SDK or MCP tool change is required
  • [ ] Only the sidecar's backend configuration changes

attestation-before-unwrap ​

The device proves its identity and state before any unwrap.

Acceptance criteria:

  • [ ] Mutual attestation occurs at binding and on unwrap
  • [ ] A failed attestation denies the operation
  • [ ] Binding is recorded against customer policy

tamper-and-loss-handling ​

Physical compromise and device loss both fail closed.

Acceptance criteria:

  • [ ] Tamper response zeroises device state
  • [ ] Lost devices are revocable by serial
  • [ ] Revocation takes effect at the authority

Test specifications ​

share-absent-from-host ​

Given:

  • device: "tpm2"

When: unwrap-via-device

Then:

  • assertion: the long-term share is not present in the sidecar's process memory
  • assertion: unwrap succeeds through the device boundary

Contracts verified: key-not-in-host-ram

api-unchanged-with-hardware ​

Given:

  • same_tokens_as_mvp: true

When: unwrap-via-device

Then:

  • assertion: token and folder formats are identical to the software phase
  • assertion: client SDKs require no modification

Contracts verified: agent-api-unchanged

failed-attestation-denies ​

Given:

  • attestation: "fail"

When: bind-device

Then:

  • assertion: the operation is denied
  • assertion: no unwrap occurs

Contracts verified: attestation-before-unwrap

lost-device-revocable-by-serial ​

Given:

  • device_serial: "SE-0001"

When: revoke-device

Then:

  • assertion: the device binding is invalidated
  • assertion: subsequent unwrap attempts fail attestation

Contracts verified: tamper-and-loss-handling

Implementation ​

  • Primary: pkg/keystore/keystore.go
  • Test code status: none

See Also ​

  • safekeys/envelope-encryption
  • safekeys/sidecar-resolution
  • safekeys/threshold-crypto