扩展另一个答案:
- 选择 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)
- 选择应用程序 DF 并在步骤 1) 中收到 AID:
T-->C - 00A4040007A000000003101000 # as example, Visa AID
T<--C - response with application DF FCI
- 获取处理选项 - 初始化事务:
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
- READ APPLICATION DATA - 用于精确的 READ APPLICATION DATA 命令编码检查 3rd 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、到期、生效日期、track 2 等效数据等...通常位于设置为用于 AFL 中的 Sighed Data Authentication 的记录中。
以上示例适用于 T=1 协议。如果卡运行 T=0 协议,响应每个假设 R-APDU(响应 APDU)包含数据字段的 APDU,卡将返回准备读取的字节数,您应该发出 GET RESPONSE 命令,该命令在 Book 1 中描述EMV 规范。
希望对你有帮助。