commit 507e5496b07f55469dbc895450b1255d5ace8988
parent 33f1d0816804152f87c8089ae8d16661aabef11e
Author: therealFIGBERT <figbertwelner@gmail.com>
Date: Wed, 28 Aug 2019 23:10:03 -0700
2.3.4 - adding more error handling
Diffstat:
3 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/Scripts/check.py b/Scripts/check.py
@@ -268,7 +268,20 @@ def weak_dec(files, key_dir):
priv = key_dir + "/private_key.pem"
sym = key_dir + "/symmetric_key.key"
proper_keys = True if (rsa and os.path.exists(priv)) or (not rsa and os.path.exists(priv) and os.path.exists(sym)) else False
- if broken_paths == "" and key_dir_access and proper_keys:
+ if proper_keys:
+ with open(priv, "rb") as priv_src:
+ try:
+ serialization.load_pem_private_key(
+ priv_src.read(),
+ password=None,
+ backend=default_backend()
+ )
+ need_pass = False
+ except TypeError:
+ need_pass = True
+ else:
+ need_pass = False
+ if broken_paths == "" and key_dir_access and proper_keys and not need_pass:
return True
else:
if broken_paths != "":
@@ -277,4 +290,6 @@ def weak_dec(files, key_dir):
prompts.key_dir_error(key_dir)
if not proper_keys:
prompts.missing_keys(key_dir)
+ if need_pass:
+ prompts.encrypted_keys()
return False
\ No newline at end of file
diff --git a/Scripts/prompts.py b/Scripts/prompts.py
@@ -29,6 +29,15 @@ def password_error(one, two):
)
)
+def encrypted_keys():
+ messagebox.showwarning(
+ "Keys are Password Locked",
+ (
+ "The keys provided are encrypted, and require a password to "
+ "function. Please attempt decryption again with a password."
+ )
+ )
+
def file_access_error(broken_paths):
"""Raise an error informing the user that some files aren't
accessible by figENC.
diff --git a/Scripts/version.txt b/Scripts/version.txt
@@ -1 +1 @@
-2.3.3
-\ No newline at end of file
+2.3.4
+\ No newline at end of file