Member-only story
Decode the EU Green-Pass QRCode Using Java
The process is done in 4 simple steps.
2 min readJul 26, 2021
This is an elaboration of the original article for python written by Tobias Schlottke
— — — — — — — — — — — — — — — — — — — — —
TL;DR: check this Github repo.
Note: The first input is the File Image. Then, for every step, the input is the output of the previous one.
1- Convert your QR code into the actual text
You will need https://github.com/zxing/zxing library:
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>core</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId>
<version>3.3.0</version>
</dependency>
The text at this point will contain a string like this:
HC1:6BdFOXN%TS3fDHPVO13J /G-/2YRVA.Q/R8NJE2FC1J9M$DIr9C3Ka9I0FULIRJPC%OQHIZC4.OI1RM8ZA.A53XHMKN4NN3F85QNCY0Or%0aVZ0r01HOC9JU0D0HT0rHB2PL/IBa09B9LW4T*8+DC9I0%YB+SG$*SBurgayE9*aFrJ7ID$0HY84Y*a9R1MR0J8-9+:I7/G90L.3T3*8%7TK3JE 4C-DM%2D-CY:aCYZ0PHN6D7LaLrK*2HG%89UV-0LZ 2ZJJ %C4IJZJJBYa43%8 C1VHLEC78aGr1TFrHM*K2ILS-O:Saf9UZ4+aFJE 4Y3LO78L:P WUQRENS431T1TC/8FYa*85RV4sdcHV%*4M/S2879aNTUZ457UR0MS0IR6W9NTF56NKE$JDVPLW1KD0K8KES/F-1JS-KELN6JKX2MZFEGRG%+T-aLL*M5Z2NY9WX42H4J-D54-UQMP$7P82D1aCV7CD-A9P-71645$DN9a80FWC/3D/IPTf7.JVGYS5%ECUGN-5KRJC/45 D2E6WBHaKS0VI49TF
This is a Base45 string prefixed by “HC1”.
2- Remove the prefix and decode the base45 string
You will need https://github.com/ehn-dcc-development/base45-java library: