makes decrypt return text or write into file
This commit is contained in:
parent
e537f9087a
commit
25b8edae4a
|
@ -107,12 +107,15 @@ def decrypt_hybrid(private_key, encrypted_data):
|
|||
|
||||
|
||||
# main function to decrypt the file
|
||||
def decrypt_file(private_key, encrypted_file, decrypted_file):
|
||||
def decrypt_file(private_key, encrypted_file, decrypted_file=None):
|
||||
with open(encrypted_file, 'rb') as f:
|
||||
encrypted_content = f.read()
|
||||
|
||||
decrypted_content = decrypt_hybrid(private_key, encrypted_content)
|
||||
|
||||
if decrypted_file is None:
|
||||
return decrypted_content
|
||||
else:
|
||||
with open(decrypted_file, 'wb') as f:
|
||||
f.write(decrypted_content)
|
||||
|
||||
|
|
Loading…
Reference in New Issue