Answer the question
In order to leave comments, you need to log in
How to back encrypt zlib cbor base45?
There is a code that decodes information from the qr code and displays its contents as readable text.
Inspired by these articles:
https://hackernoon.com/how-to-decode-your-own-eu-v...
https://ec.europa.eu/health/sites/default/files/eh...
import zlib
import flynn
import base45
qr_data_zlib_b45 = "HC1:NCFOXN%TS3DH3ZSUZK+.V0ETD%65NL-AH-R6IOO6+IUKRG*I.I5BROCWAAT4V22F/8X*G3M9JUPY0BX/KR96R/S09T./0LWTKD33236J3TA3M*4VV2 73-E3GG396B-43O058YIB73A*G3W19UEBY5:PI0EGSP4*2DN43U*0CEBQ/GXQFY73CIBC:G 7376BXBJBAJ UNFMJCRN0H3PQN*E33H3OA70M3FMJIJN523.K5QZ4A+2XEN QT QTHC31M3+E32R44$28A9H0D3ZCL4JMYAZ+S-A5$XKX6T2YC 35H/ITX8GL2-LH/CJTK96L6SR9MU9RFGJA6Q3QR$P2OIC0JVLA8J3ET3:H3A+2+33U SAAUOT3TPTO4UBZIC0JKQTL*QDKBO.AI9BVYTOCFOPS4IJCOT0$89NT2V457U8+9W2KQ-7LF9-DF07U$B97JJ1D7WKP/HLIJLRKF1MFHJP7NVDEBU1J*Z222E.GJF67Z JA6B.38O4BH*HB0EGLE2%V -3O+J3.PI2G:M1SSP2Y3D38-G9C+Q3OT/.J1CDLKOYUV5C3W1A:75S4LB:6REPKM3ZYO4+QDNDLT2*ESLIH"
# strip header ('HC1:') and decompress data:
qr_data_zlib = base45.b45decode(qr_data_zlib_b45[4:])
# decompress:
qr_data = zlib.decompress(qr_data_zlib)
# decode cose document:
(_, (headers1, headers2, cbor_data, signature)) = flynn.decoder.loads(qr_data)
# decode cbor-encoded payload:
data = flynn.decoder.loads(cbor_data)
print(data)
data
:{4: 1624458597, 6: 1624285797, 1: 'AT', -260: {1: {'v': [{'dn': 1, 'ma': 'ORG-100030215', 'vp': '1119349007', 'dt': '2021-02-18', 'co': 'AT', 'ci': 'URN:UVCI:01:AT:10807843F94AEE0EE5093FBC254BD813#B', 'mp': 'EU/1/20/1528', 'is': 'Ministry of Health, Austria', 'sd': 2, 'tg': '840539006'}], 'nam': {'fnt': 'MUSTERFRAU<GOESSINGER', 'fn': 'Musterfrau-Gößinger', 'gnt': 'GABRIELE', 'gn': 'Gabriele'}, 'ver': '1.2.1', 'dob': '1998-02-26'}}}
Answer the question
In order to leave comments, you need to log in
Obviously, you need to do the reverse operations - namely, give zlib and encode in BASE45.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question