(self, encrypted_key, passphrase)
| 486 | return None |
| 487 | |
| 488 | def decrypt_key_file_argon2(self, encrypted_key, passphrase): |
| 489 | key = self.argon2( |
| 490 | passphrase, |
| 491 | output_len_in_bytes=32, |
| 492 | salt=encrypted_key.salt, |
| 493 | time_cost=encrypted_key.argon2_time_cost, |
| 494 | memory_cost=encrypted_key.argon2_memory_cost, |
| 495 | parallelism=encrypted_key.argon2_parallelism, |
| 496 | type=encrypted_key.argon2_type, |
| 497 | ) |
| 498 | ae_cipher = CHACHA20_POLY1305(key=key, iv=0, header_len=0, aad_offset=0) |
| 499 | try: |
| 500 | return ae_cipher.decrypt(encrypted_key.data) |
| 501 | except low_level.IntegrityError: |
| 502 | return None |
| 503 | |
| 504 | def encrypt_key_file(self, data, passphrase, algorithm): |
| 505 | if algorithm == "sha256": |
no test coverage detected