从万事达卡/VISA借记卡/信用卡中读取EMV数据 [英] Read EMV data from Mastercard/VISA Debit/Credit Card

查看:426
本文介绍了从万事达卡/VISA借记卡/信用卡中读取EMV数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个应用程序来读取/编码卡上的数据,PAN,有效期,客户名称,PIN等信息,到目前为止,我可以弄清楚我需要发送APDU命令以从卡中读取数据,但是在那里关于什么命令用于什么目的以及以什么特定顺序使用,似乎没有明确的文档,我无法从Mastercard/VISA中找到规范.有一些文档可以参考吗?

I am trying to build an application to read/encode data on Cards, information like PAN, expiry, customer name, PIN etc, So far I could figure out that I need to send APDU commands to read data from Card but there seems to be no clear documentation available as to what commands are used for what purpose and in what particular sequence, I couldn't find out specifications from Mastercard/VISA. Is there some documentation that can be referred to?

谢谢, 空

推荐答案

以上扩展答案:

1)选择PSE:

T-->C - 00A404000E315041592E5359532E444446303100   # select PSE
T<--C - response with FCI
T-->C - 00B2010C00
T<--C - reponse with record from selected file, read records starting from 1 until receive 6A83 (optional step in your case)

2)在步骤1)中收到具有AID的SELECT应用程序DF:

2) SELECT application DF with AID received in step 1):

T-->C - 00A4040007A000000003101000   # as example, Visa AID
T<--C - response with application DF FCI

3)获取处理选项-初始化交易:

3) GET PROCESSING OPTIONS - initialize transaction:

T-->C - 80A8000002830000    # check if PDOL presents on card, if not, only 8300 should be added to DATA filed of APDU
T<--C - 771282023C00940C0802020010010300180102019000  # just example reswponse, it will differ on different cards

上面对GET PROCESSING OPTIONS的响应是TLV编码的:

The response on GET PROCESSING OPTIONS above is TLV encoded:

77 12 - response templait, containing response data
    82 02 3C00 - AUC
    94 0C 080202001001030018010201 - AFL
    9000 - SW (Status Word), response ofapplication, telling you, that no errors occured

请注意,对GET PROCESSING OPTIONS的响应可能会以80模板的形式返回,在这种情况下,您必须自己解析它:

Note, that response to GET PROCESSING OPTIONS may be returned as 80 template, in that case, you must parse it yourelf:

80 0E - response templait, containing response data
    3C00 - AUC (always 2 bytes long)
    080202001001030018010201 - AFL
    9000 - SW (Status Word), response ofapplication, telling you, that no errors

您在AFL中很有趣,它指出了从中读取数据的位置(文件和记录号):

You are interesting in AFL, which points you, where to read data from (files and record numbers):

94 0C 
    08020200
        08 - SFI (Short File Identifier)
        02 - first record in file
        02 - last record in file
        00 - no of records to be added to Static Data Authentication
    10010300
        10 - SFI
        01 - first record in file
        03 - last record in file (respectively, 3 records to be read - 01, 02, 03)
        00 - no of records to be added to Static Data Authentication
    18010201
        18 - SFI
        01 - first record in file
        03 - last record of file
        01 - count of records from first record to be used for Static Data Authentication (01 record must be used)

SFI的编码如下:

08 = 0000 1000 - first 5 bits are real SFI, it equals to 01, last 3 bits are always set to 0

4)READ APPLICATION DATA-用于精确的READ APPLICATION DATA命令编码检查3rd EMV书:

4) READ APPLICATION DATA - for precize READ APPLICATION DATA command coding check 3rd EMV Book:

T-->C - 00B2020C00   # SFI = 01, record = 02
T<--C - response with record
T-->C - 00B2021400   # SFI = 02, record = 01
T<--C - response with record
T-->C - 00B2031400   # SFI = 02, record = 02
T<--C - response with record
etc until you process last AFL record...

PAN,有效期,生效日期,第2条等效数据等...通常位于设置为在AFL的叹息数据身份验证中使用的记录中.

PAN, expiry, effective date, track 2 equivalent data, etc... usually is located in records which are set to be used in Sighed Data Authentication in AFL.

上面的示例适用于T = 1协议.如果卡运行T = 0协议,则响应每个假定R-APDU(响应APDU)包含数据字段的APDU,卡将返回准备读取的字节数,您应发出GET RESPONSE命令,如本书第1册所述. EMV规范.

The example above is for T=1 protocol. If card runs T=0 protocol, in response to each APDU which assumes R-APDU (Response APDU) to contain Data field, card will return byte count ready to be read and you should issue GET RESPONSE commands which is described in Book 1 of EMV specification.

希望有帮助.

这篇关于从万事达卡/VISA借记卡/信用卡中读取EMV数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆