mirror of
https://gitlab.com/arnekeller/decodecovidvaccinecertificate.git
synced 2024-11-24 00:14:59 +00:00
Initial commit
This commit is contained in:
commit
5828f1f50c
43
decodeVaccineQR.py
Normal file
43
decodeVaccineQR.py
Normal file
@ -0,0 +1,43 @@
|
||||
from base45 import b45decode
|
||||
import zlib
|
||||
import cbor
|
||||
from datetime import datetime
|
||||
|
||||
# scan your QR Code using e.g. zbar-tools (zbarimg)
|
||||
|
||||
qr_decoded = b"HC1:DATA_OF_QR_CODE"
|
||||
step1 = b45decode(qr_decoded[4:])
|
||||
step2 = zlib.decompress(step1)
|
||||
step3 = cbor.loads(step2)
|
||||
step4 = step3.value
|
||||
step5 = step4[2]
|
||||
step6 = cbor.loads(step5)
|
||||
|
||||
ISSUER_CLAIM = 1
|
||||
EXPIRATION_CLAIM = 4
|
||||
IAT_CLAIM = 6
|
||||
|
||||
HCERT_CLAIM = -260
|
||||
EU_DGC_V1_CLAIM = 1
|
||||
|
||||
print("Country:", step6[ISSUER_CLAIM])
|
||||
print("Issue date (UTC):", datetime.utcfromtimestamp(step6[IAT_CLAIM]).strftime('%Y-%m-%d %H:%M:%S'))
|
||||
print("Expiration date (UTC):", datetime.utcfromtimestamp(step6[EXPIRATION_CLAIM]).strftime('%Y-%m-%d %H:%M:%S'))
|
||||
|
||||
step7 = step6[HCERT_CLAIM][EU_DGC_V1_CLAIM]
|
||||
|
||||
print("Name:", step7["nam"])
|
||||
print("Date of birth:", step7["dob"])
|
||||
print("Schema version:", step7["ver"])
|
||||
print("Certificate info: ...")
|
||||
for step8 in step7["v"]:
|
||||
print("Unique Certificate Identifier:", step8["ci"])
|
||||
print("Country:", step8["co"])
|
||||
print("Date of vaccination:", step8["dt"])
|
||||
print("Dose number:", step8["dn"])
|
||||
print("Doses required:", step8["sd"])
|
||||
print("Targeted disease:", step8["tg"], "(expected value: COVID-19 = 840539006)")
|
||||
print("Vaccine type:", step8["vp"], "(e.g. mRNA = 1119349007)")
|
||||
print("Vaccine manufacturer:", step8["ma"], "(e.g. Biontech = ORG-100032015)")
|
||||
print("Medical product ID:", step8["mp"], "(e.g. Comirnaty = EU/1/20/1528)")
|
||||
print("Certificate issuer:", step8["is"])
|
29
poetry.lock
generated
Normal file
29
poetry.lock
generated
Normal file
@ -0,0 +1,29 @@
|
||||
[[package]]
|
||||
name = "base45"
|
||||
version = "0.4.1"
|
||||
description = "Base45 Encoder/Decoder"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=3.7,<4.0"
|
||||
|
||||
[[package]]
|
||||
name = "cbor"
|
||||
version = "1.0.0"
|
||||
description = "RFC 7049 - Concise Binary Object Representation"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = "*"
|
||||
|
||||
[metadata]
|
||||
lock-version = "1.1"
|
||||
python-versions = "^3.8"
|
||||
content-hash = "37666b70034bae04212d4c588e48e584f8e445517fd83d4dadb4a92caf927e33"
|
||||
|
||||
[metadata.files]
|
||||
base45 = [
|
||||
{file = "base45-0.4.1-py3-none-any.whl", hash = "sha256:ba5e93482c8954583e29643ef236af8fa804383d5961e5d2630d2ed6577111a0"},
|
||||
{file = "base45-0.4.1.tar.gz", hash = "sha256:dd963b02f8933770851f7f430b952f1fb7d71e0d261df981b2d5486996ec52c1"},
|
||||
]
|
||||
cbor = [
|
||||
{file = "cbor-1.0.0.tar.gz", hash = "sha256:13225a262ddf5615cbd9fd55a76a0d53069d18b07d2e9f19c39e6acb8609bbb6"},
|
||||
]
|
17
pyproject.toml
Normal file
17
pyproject.toml
Normal file
@ -0,0 +1,17 @@
|
||||
[tool.poetry]
|
||||
name = "decodecovidvaccinecertificate"
|
||||
version = "0.1.0"
|
||||
description = ""
|
||||
authors = ["Arne Keller <arne.keller@posteo.de>"]
|
||||
license = "GPL-3.0-or-later"
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.8"
|
||||
cbor = "^1.0.0"
|
||||
base45 = "^0.4.1"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=1.0.0"]
|
||||
build-backend = "poetry.core.masonry.api"
|
Loading…
Reference in New Issue
Block a user