Parse CV Rule from CVM List for EMV

房东的猫 提交于 2019-12-21 04:51:36

问题


I have succesfully retrieved the CVM List from EMV card.

0000 0000 0000 0000 4103 4203 1E03 1F02

From the EMV specification book 3, the first 4 bytes and second 4 bytes are amount and rest is CV rules. Making these the CV Rule 4103 4203 1E03 1F02

The book also shows how to parse the CV rules, as shown below:

I am assuming that I need to convert the first two bytes in a CV rule to binary and match with the table above? But why does the table above have empty cells? Also can someone explain in a simple pseudo code algorithm to parse this?


回答1:


Have you referred section 10.5.5 CVM Processing Logic in the same book ? It has it detailed and even as a flow cart.

As to the empty bits read as RFU.

This is how your sample is parsed.

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



回答2:


Q: (DO) I need to convert the first two bytes in a CV rule to binary and match with the table above?

A: In the example tag 0x8E value you have:

  • 2 amounts each 4 bytes length, 8 bytes in total.
  • group of 4 Cardholder Verification (CV) Rules each 2 bytes, 8 bytes total CVM list length. Where in each 2 bytes rule:
    • Byte 1 is "Cardholder Verification Method (CVM) Code" which is binary table of in your request. Example: HEX value needs to be converted to binary format. Where HEX 0x41 == binary b01000001. Then match bits to the table 39 with CVM Codes.
    • Byte 2 is "Cardholder Verification Method (CVM) Condition Code". The table with descriptions presented in EMV specification.

Q: But why does the table above have empty cells?

A: Because there are two Amounts 4 bytes each (8 HEX characters) in front of Tag value. Then exactly CVM rules list.

Q: Also can someone explain in a simple pseudo code algorithm to parse this?

A: See example of parsing CVM List tag 0x8E value.

---
# 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


来源:https://stackoverflow.com/questions/47000091/parse-cv-rule-from-cvm-list-for-emv

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!