From 45d98cdbf95580ea7e21d17a0518993fe23914a0 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Fri, 16 Apr 2021 14:41:35 +0300 Subject: Passing auth test --- scripts/encryptor.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/encryptor.py b/scripts/encryptor.py index 008ac51..2dac487 100644 --- a/scripts/encryptor.py +++ b/scripts/encryptor.py @@ -20,16 +20,28 @@ cipher = Cipher(algorithms.AES(key), mode) encryptor = cipher.encryptor() -padder = padding.PKCS7(128).padder() -payload_string = """{"public_key":"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzJN9ALFoUHE8SigFhtql -\\n+GPI6dIVHDCfAFXe6DU131yXoL14imBRBb5SevMou5WGiL7XBTdtlRaY8+dkNdFz\\nWEMhPoe++/GvV3u6Mq6UAJMjuiJj838NbJVl+83+NEP66htXpqidTIdr -7syaRU1T\\n0PfgvVYdNkwiWkTVtwveRchGtUwp2iZePMSF1+vtKKDvzXgZuwrKBhwBFXz6ApSZ\\n+eGkWhK1pW6TRTSENlySwb/DEg5PckzOzApLTTQqi4uu+sHU -D+McAtOP9pNILwst\\nG87LxNEO0roFqUaDIhRolgkF8jol2BUZmKChdy84XX+L6jpqDvPsxuTUpIghr0Jq\\nvQIDAQAB\\n-----END PUBLIC KEY-----","st -udent_id":"e223795","passwd":"pmcTCKox99NFsqp"}""" +payload = dict() +payload["public_key"] = """-----BEGIN PUBLIC KEY----- +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoNsLhsQzL+5HiGuaI4mu +K0TqiLEOFPOl8kd9pWR8eop0b7/N2ggDRXATIkV+XwzeQp+k9lGT1h2B2bDhxn51 +lBESb2rSqKKzTVf4SXoPxqvPwsi1bnmHcRG8tTr+ZWcJdblXabMUkKUJCrwKhvr8 +UpOi0tndcc7buVq4EWCIBUeG4SCFHeBu1Ue9Zus7BpwjSxF4jHH4M8ssl/ioN8+m +qz9LcDQe3kvVRMlVbaXjYnWyP0VjwRbQuwIjMsDVaTQUIVtPZY9el7LiIxCqZ4mO +cnnwlIZyGLN52uqDZ1cz7aSO18YIGcbCpxuOuPhSzrnZNvHJZFIkacd477fK+PKB +7QIDAQAB +-----END PUBLIC KEY-----""" +payload["student_id"] = "e223795" +payload["passwd"] = "pmcTCKox99NFsqp" + +import json +payload_string = json.dumps(payload) byte_guys = str.encode(payload_string) + +padder = padding.PKCS7(128).padder() padded_data = padder.update(byte_guys) +padded_data += padder.finalize() ct = encryptor.update(padded_data) + encryptor.finalize() -- cgit v1.2.3-70-g09d2