rename --copy-ae-key into --copy-crypt-key

This commit is contained in:
Thomas Waldmann 2022-08-04 10:16:54 +02:00
parent afa282c977
commit 4ec17d969c
2 changed files with 8 additions and 7 deletions

View File

@ -22,7 +22,7 @@ class RCreateMixIn:
path = args.location.canonical_path()
logger.info('Initializing repository at "%s"' % path)
if other_key is not None:
other_key.copy_ae_key = args.copy_ae_key
other_key.copy_crypt_key = args.copy_crypt_key
try:
key = key_creator(repository, args, other_key=other_key)
except (EOFError, KeyboardInterrupt):
@ -160,7 +160,7 @@ class RCreateMixIn:
By default, only the ID key and chunker secret will be the same (these are important
for deduplication) and the AE crypto keys will be newly generated random keys.
Optionally, if you use ``--copy-ae-key`` you can also keep the same AE crypto keys
Optionally, if you use ``--copy-crypt-key`` you can also keep the same crypt_key
(used for authenticated encryption). Might be desired e.g. if you want to have less
keys to manage.
@ -218,8 +218,9 @@ class RCreateMixIn:
help="create the parent directories of the repository directory, if they are missing.",
)
subparser.add_argument(
"--copy-ae-key",
dest="copy_ae_key",
"--copy-crypt-key",
dest="copy_crypt_key",
action="store_true",
help="copy the authenticated encryption (AE) key from the key of the other repo (default: new random key).",
help="copy the crypt_key (used for authenticated encryption) from the key of the other repo "
"(default: new random key).",
)

View File

@ -191,7 +191,7 @@ class KeyBase:
self.compressor = Compressor("lz4")
self.decompress = self.compressor.decompress
self.tam_required = True
self.copy_ae_key = False
self.copy_crypt_key = False
def id_hash(self, data):
"""Return HMAC hash using the "id" HMAC key"""
@ -603,7 +603,7 @@ class FlexiKey:
raise Error("Copying key material to an AES-CTR based mode is insecure and unsupported.")
if not uses_same_id_hash(other_key, key):
raise Error("You must keep the same ID hash (HMAC-SHA256 or BLAKE2b) or deduplication will break.")
if other_key.copy_ae_key:
if other_key.copy_crypt_key:
# give the user the option to use the same authenticated encryption (AE) key
crypt_key = other_key.crypt_key
else: