From 56019cc276ab6031de807b8118dd077b5b6e44cf Mon Sep 17 00:00:00 2001 From: f4-u57 Date: Thu, 9 Nov 2023 21:28:26 -0700 Subject: [PATCH 1/2] change crypto lv13 checks order --- cryptography/run | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cryptography/run b/cryptography/run index 80e42dca..684ccdbb 100755 --- a/cryptography/run +++ b/cryptography/run @@ -308,7 +308,6 @@ def level13(): show_b64("root certificate signature", root_certificate_signature) user_certificate_data = input_b64("user certificate") - user_certificate_signature = input_b64("user certificate signature") try: user_certificate = json.loads(user_certificate_data) @@ -339,6 +338,8 @@ def level13(): print(f"Untrusted user certificate signer: `{user_signer}`", file=sys.stderr) exit(1) + user_certificate_signature = input_b64("user certificate signature") + user_signer_key = root_trusted_certificates[user_signer]["key"] user_certificate_hash = SHA256Hash(user_certificate_data).digest() user_certificate_check = pow( From fc9bba31793bd2b2e4c67e508e90f660769f39e9 Mon Sep 17 00:00:00 2001 From: f4-u57 Date: Thu, 9 Nov 2023 21:45:06 -0700 Subject: [PATCH 2/2] change crypto lv14 checks order --- cryptography/run | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cryptography/run b/cryptography/run index 684ccdbb..54f931cb 100755 --- a/cryptography/run +++ b/cryptography/run @@ -438,8 +438,6 @@ def level14(): exit(1) user_certificate_data = decrypt_input_b64("user certificate") - user_certificate_signature = decrypt_input_b64("user certificate signature") - user_signature = decrypt_input_b64("user signature") try: user_certificate = json.loads(user_certificate_data) @@ -470,6 +468,8 @@ def level14(): print(f"Untrusted user certificate signer: `{user_signer}`", file=sys.stderr) exit(1) + user_certificate_signature = decrypt_input_b64("user certificate signature") + user_signer_key = root_trusted_certificates[user_signer]["key"] user_certificate_hash = SHA256Hash(user_certificate_data).digest() user_certificate_check = pow( @@ -482,6 +482,8 @@ def level14(): print("Untrusted user certificate: invalid signature", file=sys.stderr) exit(1) + user_signature = decrypt_input_b64("user signature") + user_signature_data = ( name.encode().ljust(256, b"\0") + A.to_bytes(256, "little") +