[core] Vault and generators: Argon2id key slot + XChaCha20-Poly1305 file, atomic save, item templates, memorable/nickname/random/PIN/strict generators
This commit is contained in:
+4
-3
@@ -67,7 +67,7 @@ with "unsupported KDF parameters", before any work:
|
||||
| Parameter | Allowed | Default written by Custos |
|
||||
|:--|:--|:--|
|
||||
| m_cost | 8·p ..= 2 097 152 KiB (2 GiB) | 65 536 KiB (64 MiB) |
|
||||
| t_cost | 1 ..= 64 | 3 (measured ≈ 0.5–1 s on the dev machine, see `custos-vault` `KdfParams::DEFAULT`) |
|
||||
| t_cost | 1 ..= 64 | 20 (≈ 0.75 s per unlock on the dev machine; `examples/kdf_timing.rs` measures it) |
|
||||
| p_cost | 1 ..= 16 | 1 |
|
||||
|
||||
The parameters are stored per file, so a later version can raise the defaults; a vault keeps its
|
||||
@@ -169,8 +169,9 @@ become *protected* strings.
|
||||
1. The new bytes go to `<name>.custos.tmp` in the same folder; the file is flushed with `fsync`.
|
||||
2. If `<name>.custos` exists, it is copied to `<name>.custos.bak.tmp`, flushed, and renamed over
|
||||
`<name>.custos.bak`.
|
||||
3. `<name>.custos.tmp` is renamed over `<name>.custos` (`MoveFileEx` with `REPLACE_EXISTING` on Windows,
|
||||
`rename` on Unix, then the folder is flushed on Unix).
|
||||
3. `<name>.custos.tmp` is renamed over `<name>.custos` (`std::fs::rename`, which replaces the target; on
|
||||
Unix the folder is flushed afterwards). A rename refused because a sync client or virus scanner holds
|
||||
the file open is retried for about two seconds.
|
||||
|
||||
A crash in step 1 or 2 leaves the old vault untouched; a crash between 2 and 3 leaves both the old vault
|
||||
and an identical `.bak`. Leftover `.tmp` files are ignored and overwritten by the next save.
|
||||
|
||||
@@ -14,7 +14,7 @@ just as plainly, what it does not.
|
||||
| Attacker | Has | Gets | Why |
|
||||
|:--|:--|:--|:--|
|
||||
| Thief or sync server | The `.custos` file (any number of old versions) | Item count and sizes roughly (the ciphertext length), the KDF parameters. Nothing else. | XChaCha20-Poly1305 over the whole body; titles, URLs and usernames are inside it too. |
|
||||
| Offline guesser | The file and a GPU farm | One Argon2id evaluation (64 MiB, 3 passes by default) per guess | A 4-word memorable password with digits (~65 bits) is out of reach; a weak master password is not. **The master password is the whole defence here.** |
|
||||
| Offline guesser | The file and a GPU farm | One Argon2id evaluation (64 MiB, 20 passes by default, ≈ 0.75 s on a desktop CPU) per guess | A 4-word memorable password with digits (~65 bits) is out of reach; a weak master password is not. **The master password is the whole defence here.** |
|
||||
| Tamperer | Write access to the file | Can destroy it, or roll it back to an older version they saw. Cannot change, reorder, add or remove items unnoticed. | The header is the body's AAD; each slot's parameters are its wrap's AAD. |
|
||||
| Someone who crashes the machine mid-save | — | Nothing | Atomic save: temp file, fsync, rename; the previous version is kept as `.bak`. |
|
||||
|
||||
|
||||
Reference in New Issue
Block a user