diff --git a/src/borg/crypto/key.py b/src/borg/crypto/key.py index ab8116591b5..3691051b0a3 100644 --- a/src/borg/crypto/key.py +++ b/src/borg/crypto/key.py @@ -383,7 +383,9 @@ def init_ciphers(self, manifest_data=None): self.nonce_manager = NonceManager(self.repository, nonce) -class FlexiKeyBase: +class FlexiKey: + FILE_ID = 'BORG_KEY' + @classmethod def detect(cls, repository, manifest_data): key = cls(repository) @@ -406,12 +408,6 @@ def detect(cls, repository, manifest_data): key._passphrase = passphrase return key - def find_key(self): - raise NotImplementedError - - def load(self, target, passphrase): - raise NotImplementedError - def _load(self, key_data, passphrase): cdata = a2b_base64(key_data) data = self.decrypt_key_file(cdata, passphrase) @@ -489,16 +485,6 @@ def create(cls, repository, args): logger.info('Keep this key safe. Your data will be inaccessible without it.') return key - def save(self, target, passphrase, create=False): - raise NotImplementedError - - def get_new_target(self, args): - raise NotImplementedError - - -class FlexiKey(FlexiKeyBase): - FILE_ID = 'BORG_KEY' - def sanity_check(self, filename, id): file_id = self.FILE_ID.encode() + b' ' repo_id = hexlify(id) diff --git a/src/borg/testsuite/archiver.py b/src/borg/testsuite/archiver.py index 88181c31e18..62a33fb898b 100644 --- a/src/borg/testsuite/archiver.py +++ b/src/borg/testsuite/archiver.py @@ -36,7 +36,7 @@ from ..chunker import has_seek_hole from ..constants import * # NOQA from ..crypto.low_level import bytes_to_long, num_cipher_blocks -from ..crypto.key import FlexiKeyBase, RepoKey, KeyfileKey, Passphrase, TAMRequiredError +from ..crypto.key import FlexiKey, RepoKey, KeyfileKey, Passphrase, TAMRequiredError from ..crypto.keymanager import RepoIdMismatch, NotABorgKeyFile from ..crypto.file_integrity import FileIntegrityError from ..helpers import Location, get_security_dir @@ -2882,7 +2882,7 @@ def test_init_interrupt(self): def raise_eof(*args): raise EOFError - with patch.object(FlexiKeyBase, 'create', raise_eof): + with patch.object(FlexiKey, 'create', raise_eof): self.cmd('init', '--encryption=repokey', self.repository_location, exit_code=1) assert not os.path.exists(self.repository_location)