Last active
July 12, 2021 10:50
-
-
Save dajiaji/c0c2f28d61c8f2943a73f52f1788b67a to your computer and use it in GitHub Desktop.
A simple EUDCC verifier implementation with Python CWT: verify_and_decode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def verify_and_decode(self, eudcc: bytes) -> bytes: | |
if eudcc.startswith(b"HC1:"): | |
# Decode Base45 data. | |
eudcc = b45decode(eudcc[4:]) | |
# Decompress with zlib. | |
eudcc = zlib.decompress(eudcc) | |
# Verify and decode CWT. | |
return cwt.decode(eudcc, keys=self._dscs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment