Added readme, added exception throw and copied attack program from tp02

This commit is contained in:
LucasVerdelho 2024-03-05 12:09:58 +00:00
parent 9d9261fddd
commit 299708f56c
4 changed files with 45 additions and 1 deletions

View file

@ -40,7 +40,13 @@ def decrypt(input_file, key_file):
cipher = ChaCha20Poly1305(key)
plaintext = cipher.decrypt(nonce, ciphertext, aad)
try:
plaintext = cipher.decrypt(nonce, ciphertext, aad)
except Exception as e:
print(f"Could not validate the authentication: {e}")
return
with open(f"{input_file}.dec", "wb") as f:
f.write(plaintext)