diff --git a/src/borg/key.py b/src/borg/key.py index d3bf22b15..b7d2cf601 100644 --- a/src/borg/key.py +++ b/src/borg/key.py @@ -152,8 +152,7 @@ def id_hash(self, data): def compress(self, chunk): meta, data = chunk - data = meta.get('compress', self.compressor).compress(data) - return Chunk(data, **meta) + return meta.get('compress', self.compressor).compress(data) def encrypt(self, chunk): pass @@ -255,8 +254,8 @@ def id_hash(self, data): return sha256(data).digest() def encrypt(self, chunk): - chunk = self.compress(chunk) - return b''.join([self.TYPE_STR, chunk.data]) + data = self.compress(chunk) + return b''.join([self.TYPE_STR, data]) def decrypt(self, id, data, decompress=True): if data[0] != self.TYPE: @@ -333,10 +332,10 @@ class AESKeyBase(KeyBase): MAC = hmac_sha256 def encrypt(self, chunk): - chunk = self.compress(chunk) - self.nonce_manager.ensure_reservation(num_aes_blocks(len(chunk.data))) + data = self.compress(chunk) + self.nonce_manager.ensure_reservation(num_aes_blocks(len(data))) self.enc_cipher.reset() - data = b''.join((self.enc_cipher.iv[8:], self.enc_cipher.encrypt(chunk.data))) + data = b''.join((self.enc_cipher.iv[8:], self.enc_cipher.encrypt(data))) assert (self.MAC is blake2b_256 and len(self.enc_hmac_key) == 128 or self.MAC is hmac_sha256 and len(self.enc_hmac_key) == 32) hmac = self.MAC(self.enc_hmac_key, data) @@ -745,8 +744,8 @@ class AuthenticatedKey(ID_BLAKE2b_256, RepoKey): STORAGE = KeyBlobStorage.REPO def encrypt(self, chunk): - chunk = self.compress(chunk) - return b''.join([self.TYPE_STR, chunk.data]) + data = self.compress(chunk) + return b''.join([self.TYPE_STR, data]) def decrypt(self, id, data, decompress=True): if data[0] != self.TYPE: