简体   繁体   English

解码 EMV TLV 数据

[英]Decode EMV TLV Data

I am working on a POS application that supports EMV cards.我正在开发支持 EMV 卡的 POS 应用程序。 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.我能够从 TLV 中的 Verifone MX 读卡器读取卡数据,但在将 TLV 数据解码为可读数据时遇到了问题。

I am able to Split the data into TLV Tags and its values.我能够将数据拆分为 TLV 标签及其值。 The resultant value is in Hex instead of Decoded text.结果值是十六进制而不是解码文本。

Example:示例:

This is a sample TLV data (I got this sample TLV Data here这是一个示例 TLV 数据(我在这里得到了这个示例 TLV 数据

6F2F840E325041592E5359532E4444463031A51DBF0C1A61184F07A0000000031010500A564953412044454249548701019000

When i check this TLV in TLVUtil , I get data in certain Tags in readable format (like Tag 50 here).当我在TLVUtil 中检查此 TLV 时,我以可读格式获取某些标签中的数据(如此处的标签 50)。

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.我想知道是否有任何方法可以识别需要从十六进制转换为字符串的某些标签,或者 .Net 中是否有任何可以复制TLVUtil工具的 TLV 解析器和解码器。

Complete list of EMV tags and are available in EMVCo 4.3 specification book 3 - you can download from here - https://www.emvco.com/download_agreement.aspx?id=654 How data is represented differs from field to field. EMV 标签的完整列表,可在 EMVCo 4.3 规范手册 3 中找到 - 您可以从这里下载 - https://www.emvco.com/download_agreement.aspx?id=654数据的表示方式因字段而异。 Check 'Annex A - Data Elements Dictionary'勾选“附件 A - 数据元素字典”

Details on encoding is mentioned in section 4.3有关编码的详细信息在第 4.3 节中提到

Read both the sections and your problem solved.阅读这两部分并解决您的问题。

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.通常放置在 POS 屏幕上的标签以十六进制等效的可读字符串进行个性化。

  • 5F20 : Cardholder Name 5F20 : 持卡人姓名

  • 50 : Application Label. 50 :应用标签。

  • 5F2D : Language Preference 5F2D :语言偏好

You must know which tags can be converted.您必须知道哪些标签可以转换。

As it seems to me, programmatically you can identify something like,在我看来,以编程方式您可以识别出类似的东西,

Tag is of one byte ( 5A - Pan number ) or it contain 2 byte ( 5F20 - CARD HOLDER NAME), AND标签为 1 个字节( 5A - Pan number )或包含 2 个字节( 5F20 - CARD HOLDER NAME),并且

length is of 1 byte or 2 byte AND长度为 1 字节或 2 字节 AND

Tag is primitiv or constructed.标签是原始的或构造的。 More you can read Here更多你可以在这里阅读

and if you know the list you can get something useful Here , It define the format of tag that you are looking for.如果你知道这个列表,你可以在这里得到一些有用的东西,它定义了你正在寻找的标签格式。

Here you can hard coded the format as it is well defined.在这里,您可以对格式进行硬编码,因为它定义明确。

Hope it helps.希望它有帮助。

That data beginni g with 6F is a File Control Information (FCI) responded by an EMV card after SELECT command.以 6F 开头的数据是 EMV 卡在 SELECT 命令后响应的文件控制信息 (FCI)。 There is an example in this video also decoded and explained.这个视频中有一个例子也被解码和解释。 https://youtu.be/iWg8EBhsfjY https://youtu.be/iWg8EBhsfjY

Its easy check it out很容易检查出来

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM