Threat Model
FOKS is designed to protect your data even if a server is compromised, under the semi-honest server assumption: the server is assumed to correctly overwrite and discard data it is asked to delete, but may otherwise try to read or tamper with data. What FOKS protects against:- A server reading file contents or file names
- A server injecting or swapping data without detection
- A server rolling back data (via Merkle tree commitments)
- A compromised old device key being used to decrypt future data (forward secrecy via key rotation)
- A server that retains old ciphertext and later obtains a revoked device key — it can decrypt data that was encrypted before the rotation. This is an inherent limitation of server-side storage; the assumption is the server deletes old data on rotation.
Cryptographic Primitives
| Primitive | Algorithm |
|---|---|
| Asymmetric encryption / key agreement | Curve25519 (X25519) + ML-KEM (post-quantum) |
| Signatures | Ed25519 |
| Symmetric encryption | XSalsa20-Poly1305 (NaCl secretbox) |
| Key derivation | HMAC-SHA512 |
| Hashing | SHA-256 / SHA-512 |
Entity IDs
Every principal in FOKS (host, user, team, device, TLS cert) is identified by an EntityID: a compact public key representation.- Standard entities: 33 bytes (1-byte type tag + 32-byte Ed25519 public key)
- YubiKey entities: 34 bytes (uses ECDSA P-256, which is 33-byte compressed point)
Key-Value Store Encryption
The KV store uses a two-layer encryption scheme: Directories have a random 32-byte seed encrypted under the team’s per-team key (PTK). From the seed, three sub-keys are derived via HMAC:r_box— symmetric key used to encrypt directory entry names for listingr_mac— used to compute per-name nonces and HMACs for efficient server-side lookup without revealing namesr_comm— used for commitments
Key Rotation
Key rotation is triggered automatically when:- A device is revoked (
foks devicecommands) - A YubiKey is removed
- A user is removed from a team
foks status.
YubiKey Support
YubiKey hardware tokens can be used as device keys. The YubiKey stores an ECDSA P-256 private key that never leaves the hardware. FOKS uses PIV slots on the YubiKey. See YubiKey commands for setup instructions.Passphrase Protection
Device keys can optionally be protected by a local passphrase. The passphrase is used to unlock an encrypted key store on disk; the key itself is never transmitted to the server. Seefoks passphrase set.