从EMV的CVM列表中解析CV规则

时间:2017-10-29 12:18:25

标签: smartcard apdu smartcard-reader emv

我已成功从EMV卡中检索CVM列表。

0000 0000 0000 0000 4103 4203 1E03 1F02

从EMV规范书3中,前4个字节和后4个字节是数量,其余是CV规则。制作CV规则4103 4203 1E03 1F02

本书还展示了如何解析CV规则,如下所示: enter image description here

我假设我需要将CV规则中的前两个字节转换为二进制并与上面的表匹配?但为什么上面的表有空单元格呢? 还有人可以用简单的伪代码算法来解释这个吗?

2 个答案:

答案 0 :(得分:3)

您是否在同一本书中引用了 10.5.5 CVM处理逻辑部分?它有详细的,甚至作为流动车。

关于读取为RFU的空位。

这就是解析样本的方式。

41 03

41 => 0100 0001
Apply succeeding CV Rule if this CVM is unsuccessful
Plaintext PIN verification performed by ICC

03
If terminal supports the CVM
---------------------------------------------------

Similarly, 
42 03

42
Apply succeeding CV Rule if thisCVM is unsuccessful
Enciphered PIN verified online

03
If terminal supports the CVM
----------------------------------------------------

1E03

1E
Signature (paper)

03
If terminal supports the CVM

----------------------------------------------------

1F 02

1F
No CVM required

02
If not unattended cash and not manual cash and not purchase
with cashback

答案 1 :(得分:0)

问:(DO)我需要将CV规则中的前两个字节转换为二进制并与上表匹配吗?

A:在示例代码0x8E中,您有:

  • 每4个字节长度为2个,总共8个字节。
  • 4组持卡人验证(CV)规则每2个字节,总共4个字节的CVM列表长度。每个2字节规则中的位置:
    • 字节1是“持卡人验证方法(CVM)代码”,它是您请求中的二进制表。示例:HEX值需要转换为二进制格式。其中HEX 0x 41 ==二进制b 01000001 。然后使用CVM代码将位匹配到表39。
    • 字节2是“持卡人验证方法(CVM)条件代码”。表格以EMV规范中的描述。

问:但为什么上面的表格中有空格?

A:因为标签值前面有两个数量,每个字节4个字节(8个十六进制字符)。然后完全是CVM规则列表。

问:也有人可以用简单的伪代码算法解释一下吗?

答:请参阅解析CVM列表标记0x8E值的示例。

---
# Cheef's parser.
# Copyright (C) 2008-2017 Alexander Shevelev. https://iso8583.info/
# lib   : "/lib/EMV/" - Integrated Circuit Card Specifications for Payment Systems
# tool  : "TV"
# stat  : 18 nodes, 4 lookup tables, 100.00% passed (4/4)

TV:#"8E0000000000000000410342031E031F02" # EMV, Cardholder Verification Method (CVM) List
- tag: "8E"
- val:#"0000000000000000410342031E031F02" # Cardholder Verification Method (CVM) List.
  - AmountX: "00000000" # Amount X
  - AmountY: "00000000" # Amount Y
  - CVRs:#"34313033343230333145303331463032" # CVM List
    - S1:#"4103" # Cardholder Verification Rule
      - CVMCode: "41" # Cardholder Verification Method (CVM) Code
        # _1______ - Apply succeeding CVR if CVM fails
        # __000001 - ICC Plain PIN verification
      - CVMCondition: "03" # Cardholder Verification Method (CVM) Condition Code // If terminal supports the CVM
    - S2:#"4203" # Cardholder Verification Rule
      - CVMCode: "42" # Cardholder Verification Method (CVM) Code
        # _1______ - Apply succeeding CVR if CVM fails
        # __000010 - Online Enciphered PIN verification
      - CVMCondition: "03" # Cardholder Verification Method (CVM) Condition Code // If terminal supports the CVM
    - S3:#"1E03" # Cardholder Verification Rule
      - CVMCode: "1E" # Cardholder Verification Method (CVM) Code
        # _0______ - Fail cardholder verification if CVM is unsuccessful
        # __011110 - Signature (paper)
      - CVMCondition: "03" # Cardholder Verification Method (CVM) Condition Code // If terminal supports the CVM
    - S4:#"1F02" # Cardholder Verification Rule
      - CVMCode: "1F" # Cardholder Verification Method (CVM) Code
        # _0______ - Fail cardholder verification if CVM is unsuccessful
        # __011111 - No CVM required
      - CVMCondition: "02" # Cardholder Verification Method (CVM) Condition Code // If not cash or cashback