mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-24 23:13:25 +00:00
also authenticate the chunkid when using the AEAD ciphers (AES-OCB/CHACHA-POLY)
This commit is contained in:
parent
8bd9477b96
commit
c50e1124b5
1 changed files with 2 additions and 2 deletions
|
@ -739,7 +739,7 @@ def encrypt(self, id, data):
|
|||
iv = self.cipher.next_iv()
|
||||
iv_48bit = iv.to_bytes(6, 'big')
|
||||
header = self.TYPE_STR + reserved + iv_48bit + self.sessionid
|
||||
return self.cipher.encrypt(data, header=header, iv=iv)
|
||||
return self.cipher.encrypt(data, header=header, iv=iv, aad=id)
|
||||
|
||||
def decrypt(self, id, data, decompress=True):
|
||||
# to decrypt existing data, we need to get a cipher configured for the sessionid and iv from header
|
||||
|
@ -749,7 +749,7 @@ def decrypt(self, id, data, decompress=True):
|
|||
iv = int.from_bytes(iv_48bit, 'big')
|
||||
cipher = self._get_cipher(sessionid, iv)
|
||||
try:
|
||||
payload = cipher.decrypt(data)
|
||||
payload = cipher.decrypt(data, aad=id)
|
||||
except IntegrityError as e:
|
||||
raise IntegrityError(f"Chunk {bin_to_hex(id)}: Could not decrypt [{str(e)}]")
|
||||
if not decompress:
|
||||
|
|
Loading…
Reference in a new issue