EMV TLV length restriction limitation to overcome

698 Views Asked by At

We have code to interrogate the values from various EMV TLVs. However, in the case of PED serial number, the spec for tag "9F1E" at http://www.emvlab.org/emvtags/ has:-

Name Description Source Format Template Tag Length P/C Interface Device (IFD) Serial Number Unique and permanent serial number assigned to the IFD by the manufacturer Terminal an 8 9F1E 8 primitive

But the above gives a limit of 8, while we have VeriFone PEDs with 9-long SNs.

So sample code relying on tag "9F1E" cannot retrieve the full length.

int GetPPSerialNumber()
{
    int rc = -1;

    rc = GetTLV("9F1E", &resultCharArray);

    return rc;
}

In the above, GetTLV() is written to take a tag arg and populate the value to a char array.

Have any developers found a nice way to retrieve the full 9?

1

There are 1 best solutions below

0
On

You're correct -- there is a mis-match here. The good thing about TLV is that you don't really need a specification to tell you how long the value is going to be. Your GetTLV() is imposing this restriction itself; the obvious solution is to relax this.

We actually don't even look at the documented lengths on the TLV-parsing level. Each tag is mapped to an associated entity in the BL (sometimes more than one thanks to the schemes going their own routes for contactless), and we get to choose which entities we want to impose a length restriction on there.