I'm trying to read AADHAAR QR code, a govt ID card in India. The user manual says -
Scanned data contains the following data fields in given sequence, which is embedded in byte array with the delimiter of byte value ”255” -
- referenceId
- name
- date of birth
My question is,
- What does it mean ?
- Can someone explain with an example?
Decoding the Aadhaar QR code consists of several steps outlined in Unique Identification Authority of India (UIDAI) in chapter 3.2:
The first few steps are:
Once you have the decompressed array, you can simply search for the first element in the array containing -1, which is how the byte value 255 looks in Java as Java uses signed integer for bytes. The bytes before the -1 can be converted to a string.
These two steps are then repeating several times with the remaining data in the array to extract further values.
Extracting the photo and the signature are slightly different as they are not strings but binary data. Again, the steps are described in the referenced document.