I am following with great interest the digital covid certificate project in java: https://github.com/ehn-dcc-development/
More specifically, for Java and to decode the pass: https://github.com/GaetanoPiazzolla/greenpass-decode
Using this code, to decode the base45 string that we read from the QR code, we have:
byte[] bytecompressed = Base45.getDecoder().decode(withoutPrefix);
I would like to encode this same string back, so I am trying the following:
byte[] byteCompressedNew = Base45.getEncoder().encode(bytecompressed);
But this results in the following error:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index -23 out of bounds for length 45 at nl.minvws.encoding.Base45$Encoder.encode(Base45.java:74)
At this line of code in the base45 module:
result[resultIndex++] = toBase45[value % 45];
It would be great if you could help me understand what I do wrong.
Thank you very much!