borgbackup/docs/usage
Thomas Waldmann d2bc45f56d
key: unify keyfile/repokey classes, locate key independent of type byte (#9743)
Borg used to read the manifest's key-type byte and then look for the key in
exactly one place (keyfile or repokey) depending on the key class that byte
selected. As a result every crypto suite was duplicated into a keyfile class
and a repokey class that differed only in TYPE, NAME, ARG_NAME and STORAGE.

Now key *location* is independent of the type byte: detection tries keyfiles
first and repokeys afterwards until a passphrase unlocks a key. The type byte
still selects the crypto suite (id hash, MAC, cipher) to instantiate. Where a
key is stored (keyfile vs repokey) is therefore a per-key property
(self.storage), not a separate class, so a repository may even hold a mix of
keyfile- and repo-stored borg keys.

With storage decoupled from class identity, the keyfile/repokey class pairs
collapse into one class per crypto suite:
- modern AEAD: AESOCBKey, CHPOKey, Blake3AESOCBKey, Blake3CHPOKey
- legacy borg 1.x (read-only): AESCTRKey, Blake2AESCTRKey
There is now exactly one type byte per modern crypto suite (the old separate
repokey type bytes 0x11/0x21/0x31/0x41 were removed; borg2 is beta and only
needs to read repos it created). identify_key() matches on TYPES_ACCEPTABLE.

CLI: --encryption selects only the crypto suite (aes-ocb, chacha20-poly1305,
blake3-aes-ocb, blake3-chacha20-poly1305, authenticated*, none); the storage
location is chosen with the new --key-location=repokey|keyfile (default
repokey). The old combined modes (repokey-aes-ocb etc.) were removed.
borg key import also gained --key-location. borg key change-location no longer
swaps key classes or rewrites the manifest; it just re-saves the unlocked key
at the new location.

Keyfile removal (key remove, change-location) now overwrites the keyfile with
random data via secure_erase() before unlinking, consistent with save().

borg 1.x legacy read compatibility is preserved (the legacy class merge is a
behavior-preserving rename; the legacy type bytes incl. PASSPHRASE stay in
TYPES_ACCEPTABLE).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-12 23:48:45 +02:00
..
general support "rest:" repository URLs, fixes #9593 2026-06-01 21:11:55 +02:00
analyze.rst analyze: sum up changed chunks per parent directory 2024-10-02 16:14:44 +02:00
analyze.rst.inc build_usage build_man 2025-12-23 18:00:09 +01:00
benchmark.rst docs: usage: add benchmark cpu and key change-location 2022-03-26 23:40:03 +01:00
benchmark_cpu.rst.inc Regenerate usage docs from current CLI help source 2026-02-22 11:50:58 +01:00
benchmark_crud.rst.inc Regenerate usage docs from current CLI help source 2026-02-22 11:50:58 +01:00
borgfs.rst [DOCS] #4587 – Make Sphinx warnings break docs build 2020-03-16 19:06:00 +01:00
borgfs.rst.inc Regenerate usage docs from current CLI help source 2026-02-22 11:50:58 +01:00
break-lock.rst.inc build_usage build_man 2025-12-23 18:00:09 +01:00
check.rst docs: split usage 2017-06-07 00:38:48 +02:00
check.rst.inc build_usage build_man 2025-12-23 18:00:09 +01:00
common-options.rst.inc remove leftover socket: protocol code 2026-06-10 18:51:55 +02:00
compact.rst fixed typos and grammar (AI) 2025-09-23 14:56:23 +02:00
compact.rst.inc build_usage build_man 2025-12-23 18:00:09 +01:00
completion.rst completion: borg can now generate completion scripts for supported shells, fixes #9172 2025-11-17 18:47:00 +01:00
completion.rst.inc completion: borg can now generate completion scripts for supported shells, fixes #9172 2025-11-17 18:47:00 +01:00
create.rst create --paths-from-shell-command, fixes #5968 2026-03-10 20:16:26 +01:00
create.rst.inc build_usage build_man 2026-03-15 14:37:50 +01:00
debug.rst fixed typos and grammar (AI) 2025-09-23 14:56:23 +02:00
delete.rst fixed typos and grammar (AI) 2025-09-23 14:56:23 +02:00
delete.rst.inc build_usage build_man 2025-12-23 18:00:09 +01:00
diff.rst diff --sort-by: enhanced sorting, fixes #8998 2025-11-03 19:25:02 +01:00
diff.rst.inc build_usage build_man 2026-03-15 14:37:50 +01:00
export-tar.rst.inc build_usage build_man 2025-12-23 18:00:09 +01:00
extract.rst extract: document how to use wildcards in PATHs 2025-10-10 11:20:08 +02:00
extract.rst.inc build_usage build_man 2025-12-23 18:00:09 +01:00
general.rst manual corrections/reverts 2025-09-23 14:56:35 +02:00
help.rst docs: split usage 2017-06-07 00:38:48 +02:00
help.rst.inc build_usage build_man 2026-03-15 14:37:50 +01:00
import-tar.rst.inc build_usage / build_man 2025-04-21 21:08:42 +02:00
info.rst docs: update about archive series 2024-09-18 14:05:12 +02:00
info.rst.inc build_usage build_man 2025-12-23 18:00:09 +01:00
key.rst key: unify keyfile/repokey classes, locate key independent of type byte (#9743) 2026-06-12 23:48:45 +02:00
key_change-location.rst.inc build_usage build_man 2025-12-23 18:00:09 +01:00
key_change-passphrase.rst.inc build_usage / build_man / doc updates 2022-06-25 21:58:19 +02:00
key_export.rst.inc Regenerate usage docs from current CLI help source 2026-02-22 11:50:58 +01:00
key_import.rst.inc build_usage / build_man 2025-04-21 21:08:42 +02:00
list.rst list: fix --pattern examples, fixes #7611 2023-06-29 23:04:21 +02:00
list.rst.inc build_usage build_man 2026-03-15 14:37:50 +01:00
lock.rst docs: split usage 2017-06-07 00:38:48 +02:00
mount.rst fixed typos and grammar (AI) 2025-09-23 14:56:23 +02:00
mount.rst.inc Regenerate usage docs from current CLI help source 2026-02-22 11:50:58 +01:00
notes.rst fixed typos and grammar (AI) 2025-09-23 14:56:23 +02:00
prune.rst fixed typos and grammar (AI) 2025-09-23 14:56:23 +02:00
prune.rst.inc build_usage build_man 2025-12-23 18:00:09 +01:00
recreate.rst fixed typos and grammar (AI) 2025-09-23 14:56:23 +02:00
recreate.rst.inc Regenerate usage docs from current CLI help source 2026-02-22 11:50:58 +01:00
rename.rst cli: rename r* commands to repo-* 2024-09-08 18:06:24 +02:00
rename.rst.inc build_usage build_man 2025-12-23 18:00:09 +01:00
repo-create.rst key: unify keyfile/repokey classes, locate key independent of type byte (#9743) 2026-06-12 23:48:45 +02:00
repo-create.rst.inc build_usage build_man 2026-03-15 14:37:50 +01:00
repo-delete.rst docs: fix usage docs and references for repo-* commands 2024-09-08 18:06:26 +02:00
repo-delete.rst.inc build_usage build_man 2025-12-23 18:00:09 +01:00
repo-info.rst docs: fix usage docs and references for repo-* commands 2024-09-08 18:06:26 +02:00
repo-info.rst.inc build_usage / build_man 2025-04-21 21:08:42 +02:00
repo-list.rst repo-list: add hostname/username/comment to default format, reorder, adjust 2024-09-26 15:53:36 +02:00
repo-list.rst.inc build_usage build_man 2026-03-15 14:37:50 +01:00
repo-space.rst docs: fix usage docs and references for repo-* commands 2024-09-08 18:06:26 +02:00
repo-space.rst.inc build_usage build_man 2026-03-15 14:37:50 +01:00
serve.rst fixed typos and grammar (AI) 2025-09-23 14:56:23 +02:00
serve.rst.inc build_usage build_man 2025-12-23 18:00:09 +01:00
tag.rst tag: set, add, remove tags 2024-10-02 23:52:39 +02:00
tag.rst.inc build_usage build_man 2026-03-15 14:37:50 +01:00
tar.rst fixed typos and grammar (AI) 2025-09-23 14:56:23 +02:00
transfer.rst key: unify keyfile/repokey classes, locate key independent of type byte (#9743) 2026-06-12 23:48:45 +02:00
transfer.rst.inc build_usage build_man 2026-03-15 14:37:50 +01:00
umount.rst.inc build_usage build_man 2025-12-23 18:00:09 +01:00
undelete.rst build_usage build_man 2024-11-16 20:14:16 +01:00
undelete.rst.inc build_usage build_man 2025-12-23 18:00:09 +01:00
usage_general.rst.inc add support for yaml config files, default config 2026-03-10 18:36:30 +01:00
version.rst scripts/gendocs.py: make it work 2024-02-09 17:37:38 +01:00
version.rst.inc build_usage build_man 2025-12-23 18:00:09 +01:00
with-lock.rst.inc build_usage build_man 2025-12-23 18:00:09 +01:00