IdParser icon indicating copy to clipboard operation
IdParser copied to clipboard

Fail to parse AAMVA ID from Illinois with 2003 spec

Open nate1280 opened this issue 5 years ago • 4 comments

When parsing an Illinois barcode that uses the 2003 AAMVA spec, I get an ArgumentOutOfRangeException thrown by the GetSubfileRecords.

Running through it manually, it attempts to parse the offset as Substring(23, 4) which results in "2901", this is incorrect, it seems it needs to be shifted left 2 characters to return "0029", with this offset it parses correctly.

https://github.com/c0shea/IdParser/blob/1002a17d267b0789014703bec5b2513a28a8adb7/IdParser/Barcode.cs#L202

I replaced the above with the following

var offsetStart = (idCard.IssuerIdentificationNumber == IssuerIdentificationNumber.Illinois) ? 21 : 23;
offset = Convert.ToInt32(input.Substring(offsetStart, 4));

And it seems to parse correctly now.

nate1280 avatar Jan 08 '19 18:01 nate1280

Do you happen to have a sample of the raw barcode (with personally identifiable information removed/changed)? I wonder if Illinois just didn't follow the spec or if there is anything else off about the header.

c0shea avatar Jan 10 '19 02:01 c0shea

Closing since I don't have example information to test this. Feel free to re-open if you can provide an anonymized example Illinois license as a test case for this issue.

c0shea avatar Jul 16 '19 02:07 c0shea

I can verify that this is a genuine issue. I can't provide any sample barcodes (for privacy reasons), but we're seeing a lot of barcodes where the offset is "2901" and as a result our parsing is failing.

Edit: We don't actually use this library, but this issue was useful in confirming that this is a problem with how Illinois have implemented the AAMVA spec.

jamesstonehill avatar Feb 19 '20 18:02 jamesstonehill

I can confirm this, here is an anonymized example (they also messed up the header and is missing the character between the \n and \r

@\n\rANSI 6360350201DL00290181DLDAAXXXX,XXXXXXXXX,Y\nDAQC9999999999\nDBA20201216\nDBB19941216\nDAG123 XXXXXXX DR\nDAIXXXXXXXXX\nDAJIL\nDAK999999999 \nDARD\nDASB \nDAT*****\nDBD20160112\nDBCF\nDAU505\nDAW113\nDAYBRN\n\r

knap1930 avatar Feb 23 '21 02:02 knap1930