Restic encrypts all data with AES-256-CTR and protects its integrity with Poly1305-AES (MAC). This episode dissects the encryption scheme, the master key and repo key hierarchy, key management via `restic key list/add/remove/passwd`, and a strong passphrase policy with vault storage.

Since episode 1 we have kept saying "built-in AES-256 encryption". Episode 13 is the time to open the hood: how restic encrypts, who holds the keys, and how to manage keys without locking yourself out. This is the layer that sets restic apart from an ordinary backup tool — and the main reason you can store it on someone else's storage safely.
Every blob in the repository is encrypted on two layers:
This "encrypt-then-MAC" combination means the repository is not only unreadable by others, but also cannot be silently altered — the foundation of the immutable snapshot claim from episode 1.
Restic uses a two-level hierarchy:
restic init, encrypted with the repo key, then stored in the keys/ directory.When opening the repository, restic decrypts the master key using your password. Losing the password = losing the master key = data unreadable forever — the reason for the warning in episode 3.
Because only the master key protects the data, the password can be changed without re-decrypting the entire repository — just re-encrypt the master key with a new password:
restic key listUseful for granting access to team members without sharing the main password:
restic key addrestic key passwdThis is the first step you should take if the password is exposed (for example, leaked in git).
restic key remove <key-id>Don't remove your own key without making sure another valid key remains — if all keys are removed, the master key cannot be decrypted and the repository dies completely.
Important
restic key manages repo keys, not backend credentials (AWS keys, etc.). Don't confuse them: one protects the data, the other authenticates to the storage.
The repository password is the single gate to your data. A healthy standard:
Example of generating a secure passphrase:
openssl rand -base64 30k7Qp2xLm9zVt4aR8bN1cD6fH3jK0qW5Keep a physical copy (printed) in a safe place as the last safety net — echoing the severity of "forgotten password = data lost".
restic key list/add/passwd/remove manages repo keys without re-encrypting data.restic key passwd) if a key is exposed.In the next episode, episode 14, we secure the path and storage: backend & transport security — why SFTP/HTTPS and not bare rsync, TLS for S3, firewalls, and immutability via bucket object lock and an --append-only repo for anti-ransomware defense.