Overview
SafeKeep is a small backup service that stores users’ files on servers the users do not trust. Data is encrypted before it leaves the client, survives the loss or corruption of a storage node, and can be shown to be intact on restore.
By the end, every member of the group should be able to:
- Choose and justify symmetric primitives and modes for data at rest, including nonce and key handling.
- Use digests and Merkle trees to detect tampering and to deduplicate content safely.
- Design a key hierarchy, including derivation from a passphrase, wrapping, rotation and recovery.
- Authenticate clients to the service and enforce access control on stored objects.
- Build redundancy so that losing one storage node loses no data.
- Deploy the server on a hardened Linux host behind a firewall, over an authenticated channel.
Important concept: Merkle Tree
A hash chain links items in a line: each entry stores the hash of the previous one, so changing any entry breaks every link after it. SafeKeep’s audit log is such a chain.
A Merkle tree applies the same idea in a tree instead of a line. Chunk hashes are the leaves, each parent is the hash of its two children, and the single root commits to every chunk at once:
root = H(H12 || H34)
/ \
H12 = H(H1 || H2) H34 = H(H3 || H4)
/ \ / \
H1 H2 H3 H4
chunk 1 chunk 2 chunk 3 chunk 4
When applied to a data backup, and look at the data content of each node, with more folders, you will get this:
root (snapshot)
/ \
docs/ photos/
/ \ / \
report.pdf notes.txt 2025/ cover.jpg
[c1 c2 c3] [c4] / \ [c9]
a.jpg b.jpg
[c5 c6] [c7 c8]
Signing only the root protects every chunk. Checking one chunk needs just its sibling hashes on the path to the root, so a client or an auditor can verify a single chunk without fetching the rest. Use a different prefix for leaf (file) and inner-node hashes (folder), so a leaf can never be passed off as an inner node.
This will allow you to store file chunks in a secure manner, enabling partial or total verification of the contents. The result is that a Merkle Tree Root secures a snapshot, and the chunks represent parts of that snapshot, which can be reused among snapshots.
Formally, this is not a pure Merkle Tree, but a Merkle DAG (Directed Acyclic Graph), and is an important component of secure storage systems such as IPFS or Git.
Besides the actual data chunks, Parity chunks are added to the DAG. These are created by XORing chunks and can be used to recover missing chunks. To simplify the design, you can consider that each folder stores the file chunks and parity chunks. If you have 5 chunks, the system will create 6 chunks where $c6 = c5 \oplus c4 \oplus c3 \oplus c2 \oplus c1$. If $c1$ is missing, it can be obtained as $c1 = c5 \oplus c4 \oplus c3 \oplus c2 \oplus c6$. The result is that any missing chunk can be recovered from the remaining, as long as there is only one missing.
System description
SafeKeep has three kinds of component: a client that does all cryptography, a coordinator that knows users and snapshots but never sees plaintext or keys, and several storage nodes that hold opaque encrypted chunks.
| Component | Runs | Holds | Trusted with |
|---|---|---|---|
| Client (CLI) | User’s machine | Passphrase, master key, plaintext files | Everything |
| Coordinator | Group’s hardened server | User accounts, public keys, encrypted snapshot manifests, chunk locations | Availability and access decisions, never confidentiality |
| Storage nodes (> 2) | Separate containers | Encrypted chunks | Nothing beyond storing bytes |
A backup works in five steps:
- The client splits each file into fixed-size chunks with content-defined chunking.
- Additional chunk is created as parity (XOR).
- Each chunk is identified by a keyed hash, so equal plaintext chunks of the same user deduplicate without revealing content to the server.
- Each chunk is encrypted with an authenticated cipher and spread across storage nodes with redundancy.
- Folders are also encoded as nodes and uploaded.
- The client builds a manifest listing files, chunk identifiers (folders and actual files) and a Merkle root, encrypts it, signs it, and uploads it to the coordinator as a new snapshot.
- On restore, the client fetches the manifest, verifies the signature and the Merkle root, retrieves chunks, and checks every chunk before writing plaintext.
The implementation language is the group’s choice. Cryptography must come from a maintained library (for example cryptography or libsodium bindings); implementing primitives yourself is not accepted.
Threat model and group variants
Every group defends against the same baseline attacker, plus a unique pair: one of 10 attacker variants and one of 3 technical profiles. That gives 30 distinct combinations. Pairs are assigned randomly.
Baseline, for all groups. The coordinator and storage nodes are honest-but-curious: they follow the protocol but read everything they store. A network attacker can observe and modify traffic between any two components. At most one storage node may fail or return corrupted data at any time. The client’s machine is trusted while it runs.
Attacker variants. Each adds one capability to the baseline, and the design must answer it.
| Variant | Added attacker capability | What the design must add | Scope limit |
|---|---|---|---|
| A · Malicious coordinator | Coordinator may drop snapshots, serve an old manifest, or swap manifests between users | Signed, chained snapshot counters checked against state the client keeps locally | The report must state what a freshly installed client can and cannot detect |
| B · Ransomware on the client | An attacker holds the client’s credentials for 24 hours, deletes history and uploads encrypted junk | Snapshots a client cannot delete or overwrite; deletion only with a separate credential; detection of a suspicious backup (for example a sudden change in most files) and restore to the last clean snapshot | Detection may be a simple threshold rule |
| C · Shared family vault | Several users share one backup set; one member is later removed | Per-member key wrapping, and rotation on removal so a removed member cannot read new snapshots | At most 3 members; snapshots made before removal may stay readable |
| D · Insider admin | A storage-node administrator wants to learn which files users have | Cross-user deduplication (two users’ identical chunks stored once), for example chunk keys derived with help from a rate-limited key server holding a secret. | The key server may be a simple service using a keyed hash; an oblivious protocol is not required |
| E · Hostile network | Storage nodes sit on a network the group does not control, and a node’s private key may leak | Mutual TLS with pinning, short-lived node certificates with automated renewal, and revocation that makes a leaked node certificate useless | Revocation may use a CRL the coordinator distributes |
| F · Stolen device | A user backs up from several devices, and one is stolen | Per-device keys enrolled by an existing device, and revocation that keeps the stolen device out of new snapshots without re-encrypting stored data | At most 3 devices; data the stolen device already held is out of scope |
| G · Mandatory erasure | Snapshots must become unrecoverable after 30 days, including copies on nodes the group cannot wipe | Per-snapshot keys and crypto-shredding, with deduplication that still works | A chunk may survive while a live snapshot references it; the report argues what is truly erased |
| H · External auditor | A third party must confirm backups are complete and intact without reading them | Integrity evidence the auditor checks with public information only: signed Merkle roots, Merkle proofs, and sampled chunk challenges | The auditor checks presence and integrity of ciphertext only |
| I · Lying storage nodes | Nodes may silently drop chunks and still claim to hold them | Periodic proof-of-storage challenges from the client, identification of the misbehaving node, and automatic repair from Parity | Challenges may use precomputed responses |
| J · Plausible Deniability | Attackers force the victim to provide the password | Manifest has a fixed number of slots, each with a root, a password can unlock one or more slots | Access can be determined by a successful decryption of the slot |
Technical profiles. Each fixes the primitives, so the same variant produces a different system.
| Profile | Chunk and manifest cipher | Passphrase KDF | Signatures |
|---|---|---|---|
| P1 | AES-CBC + HMAC-SHA256 | Argon2id | Ed25519 |
| P2 | ChaCha20-Poly1305 | scrypt | ECDSA P-256 |
| P3 | AES-256-GCM | PBKDF2 | RSA 2048 (PSS) |
Each group’s report must open with its own threat model: assets, trust boundaries, attackers including its variant, and what is explicitly out of scope. The report must also explain how its profile shaped the design.
Mandatory requirements
A project that meets every requirement below, works in the demo, and is well justified can reach full marks. Each requirement must be traceable in the report to the code that implements it and to a test that checks it.
Functional
- F1. Register a user, back up a directory, list snapshots, and restore a whole snapshot or a single file.
- F2. A second backup of an unchanged directory uploads no new chunks; a small edit to a large file uploads only the affected chunks. Others are already present.
- F3. Restore works with any one storage node offline or returning garbage.
- F4. A command verifies a snapshot end to end without restoring it, and reports which chunks or files are damaged.
Cryptography and keys
- K1. The master key is derived from the passphrase with a hard KDF, with parameters justified in the report.
- K2. Chunks and manifests use authenticated encryption with practically unique nonces
- K3. Chunk identifiers are keyed hashes, never plain hashes of plaintext.
- K4. The key hierarchy is documented as a diagram: what key encrypts what, where each key lives, and what happens when the passphrase changes.
- K5. Manifests are signed by the client, and the client verifies signature and Merkle root before trusting any content.
Authentication and access control
- A1. Clients authenticate to the coordinator with a challenge-response protocol based on a key pair; passwords are never sent to the server.
- A2. The coordinator enforces that a user can only list and fetch their own objects. Requests are checked on the server, never only in the client, by a simple mechanism.
Communication and deployment
- D1. All traffic between components runs over TLS 1.3 with certificates issued by a CA the group operates. Certificate validation is not disabled anywhere.
- D2. The coordinator runs on a hardened Linux host: a dedicated unprivileged user, SSH with keys only, a firewall policy that allows only the required ports, and other segmentation and policies as required. You can use
containerlabto setup the network and containers. - D3. The coordinator keeps an append-only, hash-chained audit log of authentication events and access decisions.
Engineering
- E1. Untrusted input from the network is validated, and errors never reveal keys, paths or stack traces to the remote side.
- E2. An automated test suite covers each requirement above, including negative tests: a tampered chunk, a replayed request, a wrong user, a corrupted node.
Milestones and deliverables
The project runs from the Project Discussion class to a defense after the exam season starts, with four checkpoints. All dates are proposals pending faculty confirmation.
| Date | Event |
|---|---|
| Oct 30, 2026 | Kickoff, variants assigned |
| Nov 20, 2026 | M1 - Design and Threat Model |
| Dec 20, 2026 | M2 - Final Delivery |
| Jan >6, 2027 | M3 - Defenses |
The exams are shown for context: M1 falls two weeks after T1, and delivery leaves a clear week before T2.
- Kickoff (Project Discussion week, 27–31 Oct). Groups are formed and each receives its variant and profile from the assignment grid.
- M1 - Design. A short document (at most 4 pages): assets, attackers including the variant, key hierarchy diagram, protocol messages, and how each requirement will be met (the decision, not the code).
- M2 - Final delivery. The repository, the report and a deployment that the faculty can reach.
- M3 - Defenses. Defense of the project in a live session.
The final delivery contains:
- The git repository with full history. Each member’s commits should reflect their own work.
- A report (at most 20 pages) with the threat model, design, the decision log described below, a requirement mapped to code and test script table, the security evaluation, and known limitations.
- A decision log: for each significant choice, the alternatives considered, why they were rejected, and any dead ends.
- Scripts that deploy the whole system from scratch on the SIO virtual machine.
Tips
- Storage nodes can be implemented as simple HTTP RESTFUL servers that exposes a folder with chunks. Standard HTTP Methods can be used to
GET,PUTandDELETEfiles. - The coordinator can be implemented as an HTTP API and doesn’t need a Web Interface.
- The client can be a CLI tool.
containerlabcan be used to quickly setup a network with nodes as docker containers.
Evaluation and defense
Most of the grade rewards understanding and evidence rather than features. Grading will consider Design, Implementation, Report, Decisions, and Defense.
The defense lasts about 30 minutes per group, with every member present. Each student may be asked to:
- Explain a randomly chosen part of the code: what it does, which threat it addresses, and what breaks without it.
- Make a small live change in the group’s repository, such as adding a check, or changing a parameter and explaining the effect.
- Answer “what if” questions about the solution, such as a reused nonce, a node returning an old chunk, or a stolen client key, and point to where the system handles or fails to handle it.
- Answer about common attacks against its own system (tampering, replay, rollback, node failure, unauthorised access).
A student who cannot explain the group’s work receives a lower individual grade than the group, regardless of the quality of the delivery. The faculty may also adjust individual grades based on commit history. Defense will be very relevant.
Rules
Groups. Groups of 3 students. Smaller groups need explicit faculty authorization and do not get a reduced scope.
Use of AI assistants. Using LLMs and coding assistants is allowed, with disclosure. The delivery must include a short section stating which parts were assisted, which tools were used, and how the group verified the result. The faculty will focus the defense on those parts. Not being able to explain code you submitted is treated as not having done it, whoever or whatever wrote it.
Third-party code. Libraries are allowed and expected for cryptography, networking and storage. Code copied from other sources must be attributed in the repository. Copying another group’s work, in either direction, is academic misconduct and is handled under the university’s regulations.
Submission. Deliveries are made through the classroom50 platform, as a tag on the default branch, by the deadline. Only content in the tagged commit is assessed. The deployment must stay reachable until the defense.