From e49fde947b6f7340f7af633bf760746ce839c246 Mon Sep 17 00:00:00 2001 From: Pradeep krishnamurthy Date: Thu, 19 May 2022 22:07:53 +0200 Subject: [PATCH] pem2john.py: Check 'prf algorithm' and reject anything other than 'sha1' --- run/pem2john.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/run/pem2john.py b/run/pem2john.py index 55ac40789a7..58c0a5ba91a 100755 --- a/run/pem2john.py +++ b/run/pem2john.py @@ -66,7 +66,7 @@ def unwrap_pkcs8_data(blob): if data["encryption_algorithm"]["algorithm"] != "pbes2": sys.stderr.write("[%s] encryption_algorithm <%s> is not supported currently!\n" % (sys.argv[0], data["encryption_algorithm"]["algorithm"])) - return False + return True # encryption data encrypted_data = data["encrypted_data"] @@ -77,8 +77,13 @@ def unwrap_pkcs8_data(blob): if kdf["algorithm"] != "pbkdf2": sys.stderr.write("[%s] kdf algorithm <%s> is not supported currently!\n" % (sys.argv[0], kdf["algorithm"])) - return False + return True kdf_params = kdf["parameters"] + if kdf_params["prf"]["algorithm"] != "sha1": + sys.stderr.write("[%s] prf algorithm <%s> is not supported currently!\n" % + (sys.argv[0], kdf_params["prf"]["algorithm"])) + return True + salt = kdf_params["salt"] iterations = kdf_params["iteration_count"]