-1

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,

  1. What does it mean ?
  2. Can someone explain with an example?
Gissipi_453
  • 1,250
  • 1
  • 25
  • 61
  • 1
    255 == `(byte) -1` which separates the three fields. Simply try getting the data of such a QR (the shown one, by smart phone?).P.S. I think the downvote might have been triggered by the title being unspecific/misleading and no effort (like the data of the shown QR.) and just an external link which might become broken. – Joop Eggen Nov 03 '20 at 08:19

1 Answers1

1

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:

  • Convert the base10 value of Secure QR code into Big Integer.
  • Convert the Big Integer into byte array.
  • Decompress the byte array.
  • Read the value of byte array from index 0 to till first delimiter value "255" and convert this byte array value into string with encoding "ISO-8859-1". We will get the Email_mobile_present_bit_indicator_value as 0, 1, 2 or 3.

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.

Codo
  • 75,595
  • 17
  • 168
  • 206