diff --git a/cryptography/rsa-sig/dispatcher b/cryptography/rsa-sig/dispatcher index 697f8d6..2d50200 100755 --- a/cryptography/rsa-sig/dispatcher +++ b/cryptography/rsa-sig/dispatcher @@ -2,18 +2,18 @@ import sys -from base64 import b64encode +from base64 import b64encode, b64decode n = int(open("/challenge/key-n").read(), 16) d = int(open("/challenge/key-d").read(), 16) -command = sys.argv[1].strip("\0") if len(sys.argv) > 1 else "chill" -if command == "flag": +command = b64decode(sys.argv[1].strip("\0")) if len(sys.argv) > 1 else "chill" +if b"flag" in command: print("No.") sys.exit(1) signature = pow( - int.from_bytes(command.encode('latin1'), "little"), + int.from_bytes(command, "little"), d, n ).to_bytes(256, "little")