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

Parse CV Rule from CVM List for EMV

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

0000 0000 0000 0000 4103 4203 1E03 1F02

来自EMV规范书3,前4个字节和后4个字节是金额,其余是CV规则。使这些成为 CV 规则 4103 4203 1E03 1F02

书中还展示了如何解析CV规则,如下图:

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

您是否参考了同一本书中的 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

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

A: 在示例标签 0x8E 中,您的值是:

  • 2个,每4个字节,共8个字节。
  • 一组 4 个持卡人验证 (CV) 规则,每个 2 个字节,CVM 列表总长度为 8 个字节。在每 2 个字节的规则中:
    • 字节 1 是 "Cardholder Verification Method (CVM) Code",它是您请求中的二进制 table。示例:需要将 HEX 值转换为二进制格式。其中十六进制 0x41 == 二进制 b01000001。然后用 CVM 代码将位匹配到 table39。
    • 字节 2 是 "Cardholder Verification Method (CVM) Condition Code"。 table 带有 EMV 规范中的描述。

问:为什么上面的table有空单元格?

A: 因为Tag值前面有两个Amounts,每个4字节(8个HEX字符)。然后就是CVM规则列表。

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

A: 见解析CVM List标签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