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

Method decrypt_key_file

src/borg/crypto/key.py:432–446  ·  view source on GitHub ↗
(self, data, passphrase)

Source from the content-addressed store, hash-verified

430 return False
431
432 def decrypt_key_file(self, data, passphrase):
433 unpacker = get_limited_unpacker("key")
434 unpacker.feed(data)
435 data = unpacker.unpack()
436 encrypted_key = EncryptedKey(internal_dict=data)
437 if encrypted_key.version != 1:
438 raise UnsupportedKeyFormatError()
439 else:
440 self._encrypted_key_algorithm = encrypted_key.algorithm
441 if encrypted_key.algorithm == "sha256":
442 return self.decrypt_key_file_pbkdf2(encrypted_key, passphrase)
443 elif encrypted_key.algorithm == "argon2 chacha20-poly1305":
444 return self.decrypt_key_file_argon2(encrypted_key, passphrase)
445 else:
446 raise UnsupportedKeyFormatError()
447
448 @staticmethod
449 def pbkdf2(passphrase, salt, iterations, output_len_in_bytes):

Calls 6

get_limited_unpackerFunction · 0.85
feedMethod · 0.80
unpackMethod · 0.80