borgbackup/docs
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
..
3rd_party fixed typos and grammar (AI) 2025-09-23 14:56:23 +02:00
_static revert logo colour to #00dd00 (per @TW) 2017-08-16 17:50:59 +02:00
_templates docs: offer a PDF download and link offline formats in the sidebar, fixes #9731 2026-06-09 02:08:14 +02:00
binaries CI: use macOS 15 for binary builds 2025-12-15 17:40:51 +01:00
borg_theme/css docs: offer a PDF download and link offline formats in the sidebar, fixes #9731 2026-06-09 02:08:14 +02:00
deployment remove ssh:// and socket:// remote repository for current repos 2026-06-08 08:04:59 +02:00
internals remove xxhash / xxh64 requirement, mentions 2026-06-10 00:38:18 +02:00
man build_usage build_man 2026-03-15 14:37:50 +01:00
misc manual corrections/reverts 2025-09-23 14:56:35 +02:00
usage key: unify keyfile/repokey classes, locate key independent of type byte (#9743) 2026-06-12 23:48:45 +02:00
authors.rst fix levels in authors section 2016-11-04 21:14:59 -04:00
book.rst fixed typos and grammar (AI) 2025-09-23 14:56:23 +02:00
changes.rst key: unify keyfile/repokey classes, locate key independent of type byte (#9743) 2026-06-12 23:48:45 +02:00
changes_0.x.rst fixed typos and grammar (AI) 2025-09-23 14:56:23 +02:00
changes_1.x.rst fixed typos and grammar (AI) 2025-09-23 14:56:23 +02:00
conf.py docs: offer a PDF download and link offline formats in the sidebar, fixes #9731 2026-06-09 02:08:14 +02:00
deployment.rst add non-root deployment strategy 2024-02-24 21:17:01 +01:00
development.rst CI: use locked requirements, add canary job, fixes #9361 2026-03-12 15:01:00 +01:00
faq.rst remove xxhash / xxh64 requirement, mentions 2026-06-10 00:38:18 +02:00
global.rst.inc remove xxhash / xxh64 requirement, mentions 2026-06-10 00:38:18 +02:00
index.rst fixed typos and grammar (AI) 2025-09-23 14:56:23 +02:00
installation.rst remove python 3.10 support (master branch), fixes #9707 2026-06-06 15:34:05 +02:00
internals.rst docs: add pack file format design and internals documentation, refs #8572 2026-05-27 13:26:18 +05:30
introduction.rst fixed typos and grammar (AI) 2025-09-23 14:56:23 +02:00
Makefile fixed typos and grammar (AI) 2025-09-23 14:56:23 +02:00
man_intro.rst fixed typos and grammar (AI) 2025-09-23 14:56:23 +02:00
quickstart.rst improve docs / comments 2026-06-09 00:49:50 +02:00
quickstart_example.rst.inc key: unify keyfile/repokey classes, locate key independent of type byte (#9743) 2026-06-12 23:48:45 +02:00
support.rst docs: reflow some really long lines 2020-03-11 16:27:57 -07:00
usage.rst repo-compress: remove this command for now 2026-05-22 13:00:13 +02:00
usage_general.rst.inc [DOCS] #4587 – Make Sphinx warnings break docs build 2020-03-16 19:22:59 +01:00