Commit dbbe3f44 authored by Leon Tappe's avatar Leon Tappe 🔥
Browse files

Merge branch 'qr-fix' of git.uni-paderborn.de:asta/digital_3g into qr-fix

parents f5c81368 7042e79d
......@@ -209,13 +209,19 @@ def generate_ticket():
return 'ticket not signed correctly', 400
json_seed = json.loads(data.decode('utf-8'))
print(json_seed)
epoch_timestamp = parser.isoparse(json_seed['timestamp']).timestamp()
if datetime.now(tzutc()).timestamp() - epoch_timestamp > 60.0:
return 'seed older than 1 minute', 400
return jsonify(json_seed['ticket'])
# sign RSA ticket with AES encryption
cipher = AES.new(signKey, AES.MODE_EAX)
ciphertext, tag = cipher.encrypt_and_digest(
base64.b64decode(json_seed['ticket']))
combined = str(base64.b64encode(
cipher.nonce + tag + ciphertext), encoding='utf-8')
return jsonify(combined)
@bp.route('/makeseed', methods=['POST'])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment