Home  Contents

v4kf.emvDecode

V4kf Core4 Lua Event System

SYNOPSIS

v4kf.emvDecode(data[, human])

DESCRIPTION

Decodes data, which must be TLV encoded according to ISO7816-4, into a Lua table.

If human is 0 or nil, the table is structured in machine readable form. It contains key/value pairs containing the tags and data of the decoded data. Nested tags are represented by nested tables.

If human is 1, the table contains a numbered list, formatted in a human readable way. Each TLV object in the source data is represented by a nested table that contains the fields tag (The tag, hex formatted with leading 0x), data (The data contents: a string or a nested table for nested tags), name (A textual description of the tag, from the EMV standard) and, in some cases, text (A human readable representation of data).

RETURN VALUE

Returns a table.

EXAMPLE

>  > 
data = string.fromhex("6F1A840E315041592E5359532E4444463031A5088801025F2D02656E") print(table.tostring(v4kf.emvDecode(data),1))
{ [111] = { [132] = "1PAY.SYS.DDF01", [165] = { [136] = "\x02", [24365] = "en" } } }
print(table.tostring(v4kf.emvDecode(data,1),1))
{ { name = "File Control Information (FCI) Template", tag = "0x6F", data = { { name = "Dedicated File (DF) Name", text = "315041592E5359532E4444463031", tag = "0x84", data = "1PAY.SYS.DDF01" }, { name = "File Control Information (FCI) Proprietary Template", tag = "0xA5", data = { { name = "Short File Identifier (SFI)", tag = "0x88", data = "\x02" }, { name = "Language Preference", tag = "0x5F2D", data = "en" } } } } } }

SEE ALSO