commit a4d07db7c9b9ccea857b548534341c1f0d6f3b65
parent 9beee15768fb29340af86bf3ce3d8e8d22f3dd30
Author: FIGBERT <figbertwelner@gmail.com>
Date: Sun, 14 Jul 2019 13:20:58 -0700
Fixing encrypt.py error
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Scripts/encrypt.py b/Scripts/encrypt.py
@@ -25,16 +25,16 @@ def rsa_enc(target_file_raw, save_folder):
for target_file in target_file_list:
#Creating the keys from the source files
with open(public_key_source, 'rb') as public_key_file, \
- open(symmetric_key_source, 'rb') as symmetric_key_file, \
- open(target_file) as read_file:
+ open(symmetric_key_source, 'rb') as symmetric_key_file:
public_key = serialization.load_pem_public_key(
public_key_file.read(),
backend = default_backend()
)
symmetric_key_data = symmetric_key_file.read()
symmetric_key = Fernet(symmetric_key_data)
- file_data = read_file.read()
#Encrypting and outputting the data
+ with open(target_file) as read_file:
+ file_data = read_file.read()
data = symmetric_key.encrypt(bytes(file_data, 'utf-8'))
with open(target_file, 'wb') as write_file:
write_file.write(data)