You are browsing as a guest. Sign up (or log in) to start making projects!

2h 0m logged

Add HKDF-SHA256 per-project key derivation from master PSK

Implement derive_project_key in the crypto module using ring’s HKDF
implementation with SHA-256. The function takes the 256-bit master PSK as
the HKDF salt and the project UUID bytes as the info parameter, producing
a deterministic 256-bit per-project key. This design means per-project
encryption keys are never stored on disk — they are re-derived from the
master PSK and project UUID on each archive or restore operation. If the
PSK is rotated, all existing projects become inaccessible, which is
documented as a deliberate security property rather than a bug.

The HKDF-Extract step uses the PSK as the salt with an empty initial key
material, producing a pseudorandom key. HKDF-Expand then derives 32 bytes
of output key material bound to the project UUID via the info parameter,
preventing cross-project key reuse even if an attacker learns one
project’s derived key.

Four tests verify deterministic derivation, UUID binding, PSK binding,
and correct 256-bit output length.

0
2

Comments 0

No comments yet. Be the first!