gpt4 book ai didi

c# - 从 Mastercard/VISA 借记卡/信用卡读取 EMV 数据

转载 作者:行者123 更新时间:2023-12-05 01:14:31 28 4
gpt4 key购买 nike

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

谢谢,空

最佳答案

扩展另一个答案:

  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)
  1. 选择在步骤 1 中收到 AID 的申请 DF):
T-->C - 00A4040007A000000003101000   # as example, Visa AID
T<--C - response with application DF FCI
  1. 获取处理选项 - 初始化交易:
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 编码的:

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 模板返回,在这种情况下,您必须自己解析它:

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 很感兴趣,它指向你,从哪里读取数据(文件和记录号):

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
  1. READ APPLICATION DATA - 用于精确的 READ APPLICATION DATA 命令编码检查第 3 EMV 手册:
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 中用于 Sighed Data Authentication。

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

希望对你有帮助。

关于c# - 从 Mastercard/VISA 借记卡/信用卡读取 EMV 数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58299515/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com