Skip to content

safekeys/threshold-crypto [planned] ​

Phase 2 hardening splits key knowledge between the secure element and the authority, reconstructs ephemerally only inside the element for a requested operation, and adds a hybrid classical plus ML-KEM-class ratchet on control-plane sessions with remote attestation before unwrap. No single compromised component holds enough to reconstruct a key.

Status: planned

Why this exists ​

A hardware root protects a key from a compromised host, but the device itself remains a single point of trust and long-lived ciphertext remains exposed to future quantum capability. Threshold splitting removes the single holder, and a post-quantum ratchet protects sessions against harvest-now-decrypt-later.

Design decisions ​

defer-to-phase-2 [accepted] ​

Decision: Keep threshold crypto and post-quantum ratchets out of the MVP and Phase 1.

Rationale: The MVP already meets the product promise with software isolation, and the blueprint is explicit that the agent-facing surface must not change when these land. Deferring keeps time to beta short without weakening the shipped guarantee.

hybrid-not-pq-only [accepted] ​

Decision: Use a hybrid classical plus ML-KEM-class construction rather than post-quantum only.

Rationale: Hybrid avoids depending entirely on relatively young PQ primitives while still closing the harvest-now-decrypt-later exposure.

threshold-over-single-device [accepted] ​

Decision: Split knowledge across element and authority rather than trusting a single device.

Rationale: A secure element is a strong boundary but still one holder; splitting means compromise of the device and compromise of the authority are both required, which is the difference between a breach and a non-event.

How it works ​

Split key knowledge across holders (split-key-shares) ​

One share lives in the secure element; complementary shares live at the authority.

  1. Generate — Provisioning splits key knowledge into shares with a threshold policy.
  2. Setup — One share is installed in the secure element; complementary shares are held at the authority.
  3. Observe — No single holder can reconstruct the key alone.

Reconstruct ephemerally inside the element (ephemeral-reconstruction) ​

The key exists only inside the secure element for the duration of one operation.

  1. Receive — Device receives an authorised operation request and attests remotely.
  2. Validate — Remote attestation succeeds before any unwrap is permitted.
  3. Generate — The key is reconstructed inside the element for the requested operation only.
  4. Delete — The reconstructed material is destroyed when the operation completes.

Hybrid post-quantum session ratchet (hybrid-ratchet) ​

Control-plane sessions use a classical plus PQ ratchet.

  1. Setup — Negotiate a hybrid KEM combining a classical and an ML-KEM-class mechanism.
  2. Generate — Ratchet session keys forward so compromise of one key does not expose past traffic.
  3. Observe — Harvested session traffic is not decryptable by a future quantum adversary.

Guarantees ​

no-single-holder ​

No single component may be able to reconstruct the key.

Acceptance criteria:

  • [ ] Key knowledge is split with a threshold policy
  • [ ] The secure element alone is insufficient
  • [ ] The authority alone is insufficient

attest-before-unwrap ​

Remote attestation is required before any unwrap.

Acceptance criteria:

  • [ ] Attestation covers device identity and state
  • [ ] Failure denies the operation
  • [ ] Attestation is not optional or bypassable

ephemeral-only ​

Reconstructed key material exists only inside the secure element, only for one operation.

Acceptance criteria:

  • [ ] No reconstruction in host memory
  • [ ] Material is destroyed after the operation
  • [ ] Nothing persists between operations

post-quantum-sessions ​

Control-plane sessions are protected against harvest-now-decrypt-later.

Acceptance criteria:

  • [ ] Hybrid classical plus PQ key establishment
  • [ ] Forward-secret ratcheting of session keys
  • [ ] Documented as Phase 2, not MVP

Test specifications ​

single-share-insufficient ​

Given:

  • available_shares: 1
  • threshold: 2

When: split-key-shares

Then:

  • assertion: reconstruction fails
  • assertion: no key material is produced

Contracts verified: no-single-holder

unattested-device-denied ​

Given:

  • attestation: "fail"

When: ephemeral-reconstruction

Then:

  • assertion: unwrap is denied
  • assertion: no reconstruction occurs

Contracts verified: attest-before-unwrap

reconstruction-does-not-persist ​

Given:

  • operations: 2

When: ephemeral-reconstruction

Then:

  • assertion: no reconstructed material survives between operations
  • assertion: host memory never contains the key

Contracts verified: ephemeral-only

session-ratchet-forward-secret ​

Given:

  • compromise: "session key at time T"

When: hybrid-ratchet

Then:

  • assertion: traffic before T is not decryptable
  • assertion: the hybrid KEM was used for establishment

Contracts verified: post-quantum-sessions

Implementation ​

  • Primary: pkg/protocol/envelope.go
  • Test code status: none

See Also ​

  • safekeys/hardware-root
  • safekeys/envelope-encryption
  • safekeys/sidecar-resolution