diff --git a/src/borg/cache.py b/src/borg/cache.py index 7dbde9ce9..d37db1814 100644 --- a/src/borg/cache.py +++ b/src/borg/cache.py @@ -62,7 +62,7 @@ class SecurityManager: def __init__(self, repository): self.repository = repository - self.dir = get_security_dir(repository.id_str) + self.dir = get_security_dir(repository.id_str, legacy=(repository.version == 1)) self.cache_dir = cache_dir(repository) self.key_type_file = os.path.join(self.dir, "key-type") self.location_file = os.path.join(self.dir, "location") @@ -71,7 +71,7 @@ def __init__(self, repository): @staticmethod def destroy(repository, path=None): """destroy the security dir for ``repository`` or at ``path``""" - path = path or get_security_dir(repository.id_str) + path = path or get_security_dir(repository.id_str, legacy=(repository.version == 1)) if os.path.exists(path): shutil.rmtree(path) diff --git a/src/borg/crypto/key.py b/src/borg/crypto/key.py index c9caf7819..76d225ec1 100644 --- a/src/borg/crypto/key.py +++ b/src/borg/crypto/key.py @@ -114,7 +114,7 @@ def key_factory(repository, manifest_chunk, *, ro_cls=RepoObj): def tam_required_file(repository): - security_dir = get_security_dir(bin_to_hex(repository.id)) + security_dir = get_security_dir(bin_to_hex(repository.id), legacy=(repository.version == 1)) return os.path.join(security_dir, "tam_required") diff --git a/src/borg/testsuite/key.py b/src/borg/testsuite/key.py index f0245af34..3d3292fc1 100644 --- a/src/borg/testsuite/key.py +++ b/src/borg/testsuite/key.py @@ -115,6 +115,7 @@ def canonical_path(self): _location = _Location() id = bytes(32) id_str = bin_to_hex(id) + version = 2 def save_key(self, data): self.key_data = data