rename KeyfileKeyBase -> FlexiKeyBase

it is used as direct base class for both:
- RepoKey
- KeyfileKey
This commit is contained in:
Thomas Waldmann 2022-03-06 17:07:17 +01:00
parent d42e6f2c41
commit ad405892ca
2 changed files with 5 additions and 5 deletions

View File

@ -527,7 +527,7 @@ class PassphraseKey:
NAME = 'passphrase' NAME = 'passphrase'
class KeyfileKeyBase(AESKeyBase): class FlexiKeyBase(AESKeyBase):
@classmethod @classmethod
def detect(cls, repository, manifest_data): def detect(cls, repository, manifest_data):
key = cls(repository) key = cls(repository)
@ -640,7 +640,7 @@ class KeyfileKeyBase(AESKeyBase):
raise NotImplementedError raise NotImplementedError
class KeyfileKey(ID_HMAC_SHA_256, KeyfileKeyBase): class KeyfileKey(ID_HMAC_SHA_256, FlexiKeyBase):
TYPE = 0x00 TYPE = 0x00
TYPES_ACCEPTABLE = {TYPE} TYPES_ACCEPTABLE = {TYPE}
NAME = 'key file' NAME = 'key file'
@ -731,7 +731,7 @@ class KeyfileKey(ID_HMAC_SHA_256, KeyfileKeyBase):
self.target = target self.target = target
class RepoKey(ID_HMAC_SHA_256, KeyfileKeyBase): class RepoKey(ID_HMAC_SHA_256, FlexiKeyBase):
TYPE = 0x03 TYPE = 0x03
TYPES_ACCEPTABLE = {TYPE, PassphraseKey.TYPE} TYPES_ACCEPTABLE = {TYPE, PassphraseKey.TYPE}
NAME = 'repokey' NAME = 'repokey'

View File

@ -36,7 +36,7 @@ from ..cache import Cache, LocalCache
from ..chunker import has_seek_hole from ..chunker import has_seek_hole
from ..constants import * # NOQA from ..constants import * # NOQA
from ..crypto.low_level import bytes_to_long, num_cipher_blocks from ..crypto.low_level import bytes_to_long, num_cipher_blocks
from ..crypto.key import KeyfileKeyBase, RepoKey, KeyfileKey, Passphrase, TAMRequiredError from ..crypto.key import FlexiKeyBase, RepoKey, KeyfileKey, Passphrase, TAMRequiredError
from ..crypto.keymanager import RepoIdMismatch, NotABorgKeyFile from ..crypto.keymanager import RepoIdMismatch, NotABorgKeyFile
from ..crypto.file_integrity import FileIntegrityError from ..crypto.file_integrity import FileIntegrityError
from ..helpers import Location, get_security_dir from ..helpers import Location, get_security_dir
@ -2850,7 +2850,7 @@ class ArchiverTestCase(ArchiverTestCaseBase):
def raise_eof(*args): def raise_eof(*args):
raise EOFError raise EOFError
with patch.object(KeyfileKeyBase, 'create', raise_eof): with patch.object(FlexiKeyBase, 'create', raise_eof):
self.cmd('init', '--encryption=repokey', self.repository_location, exit_code=1) self.cmd('init', '--encryption=repokey', self.repository_location, exit_code=1)
assert not os.path.exists(self.repository_location) assert not os.path.exists(self.repository_location)