summaryrefslogtreecommitdiff
path: root/verify.py
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2021-02-24 10:59:29 +0200
committerYuval Adam <_@yuv.al>2021-02-24 10:59:29 +0200
commit67a7345cc9bbe3e8e5d3110e56641e85ef4912ca (patch)
tree7e2632e1d4572c82c624e01b0db5d74404940049 /verify.py
parent443e899b6f15ca5d7fd42174921faacb2059944a (diff)
Cleanup verify code
Diffstat (limited to 'verify.py')
-rw-r--r--verify.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/verify.py b/verify.py
index 0caa13a..0102871 100644
--- a/verify.py
+++ b/verify.py
@@ -8,10 +8,8 @@ sig = base64.b64decode("base64EncodedSignature==")
payload = '{"id":"01/IL/ABCD1234ABCD1234ABCD1234ABCD1234#ABCD1234","et":1,"ct":1,"c":"IL MOH","cn":null,"fn":null,"g":null,"f":null,"gl":null,"fl":null,"idp":null,"idl":null,"b":"0001-01-01","e":"0001-01-01","a":"0001-01-01","p":[{"idl":"0123456789","e":"2021-01-01"}]}'
-pl = payload.encode("utf-8")
-
h = hashes.Hash(hashes.SHA256())
-h.update(pl)
+h.update(payload.encode("utf-8"))
digest = h.finalize()
with open("certs/RamzorQRPubKey.pem", "rb") as f:
@@ -23,7 +21,8 @@ with open("certs/RamzorQRPubKey.pem", "rb") as f:
hashes.SHA256(),
)
-json_data = json.loads(payload)
-print('Israeli ID Number ', json_data['p'][0]['idl'])
-print('ID valid by ', json_data['p'][0]['e'])
-print('Cert Unique ID =', json_data['id']) \ No newline at end of file
+
+data = json.loads(payload)
+print(f"Israeli ID Number {data['p'][0]['idl']}")
+print(f"ID valid by {data['p'][0]['e']}")
+print(f"Cert Unique ID {data['id']}")