Search code examples
c#.netemvverifonetlv

Decode EMV TLV Data


I am working on a POS application that supports EMV cards. I am able to read card data from a Verifone MX card reader in TLV, but I am facing issues in decoding the TLV data to readable data.

I am able to Split the data into TLV Tags and its values. The resultant value is in Hex instead of Decoded text.

Example:

This is a sample TLV data (I got this sample TLV Data here

6F2F840E325041592E5359532E4444463031A51DBF0C1A61184F07A0000000031010500A564953412044454249548701019000

When i check this TLV in TLVUtil, I get data in certain Tags in readable format (like Tag 50 here).

The Closest I could get in my application is this:

Tag Value
50  56495341204445424954
4F  A0000000031010
61  4F07A0000000031010500A56495341204445424954870101
6F  840E325041592E5359532E4444463031A51DBF0C1A61184F07A0000000031010500A56495341204445424954870101
84  325041592E5359532E4444463031
87  1
90  
A5  BF0C1A61184F07A0000000031010500A56495341204445424954870101
BF0C 61184F07A0000000031010500A56495341204445424954870101

I would like to know if there is any way to identify certain tags that need to be converted from Hex to string or if there is any TLV Parser and decoder available in .Net that can replicate the TLVUtil tool.


Solution

  • There are only a few tags that need to be converted to string. Generally tags that are put on POS screen personalized in hex equivalent of readable string.

    • 5F20 : Cardholder Name

    • 50 : Application Label.

    • 5F2D : Language Preference

    You must know which tags can be converted.