MCPcopy
hub / github.com/borgbackup/borg / init_ciphers

Method init_ciphers

src/borg/crypto/key.py:368–380  ·  view source on GitHub ↗
(self, manifest_data=None)

Source from the content-addressed store, hash-verified

366 self.init_from_given_data(crypt_key=data[0:64], id_key=data[64:96], chunk_seed=chunk_seed)
367
368 def init_ciphers(self, manifest_data=None):
369 enc_key, enc_hmac_key = self.crypt_key[0:32], self.crypt_key[32:]
370 self.cipher = self.CIPHERSUITE(mac_key=enc_hmac_key, enc_key=enc_key, header_len=1, aad_offset=1)
371 if manifest_data is None:
372 nonce = 0
373 else:
374 self.assert_type(manifest_data[0])
375 # manifest_blocks is a safe upper bound on the amount of cipher blocks needed
376 # to encrypt the manifest. depending on the ciphersuite and overhead, it might
377 # be a bit too high, but that does not matter.
378 manifest_blocks = num_cipher_blocks(len(manifest_data))
379 nonce = self.cipher.extract_iv(manifest_data) + manifest_blocks
380 self.cipher.set_iv(nonce)
381
382
383class FlexiKey:

Callers 2

detectMethod · 0.45
createMethod · 0.45

Calls 1

assert_typeMethod · 0.80

Tested by

no test coverage detected