获取处理选项响应

GET PROCESSING OPTIONS Response

我正在尝试了解如何为智能卡创建 CDOL1,但小程序开发人员的帮助不大。当我向卡发送 GET PROCESSING OPTIONS 命令时,我收到以下响应:

80 0E 7D 00 40 01 01 00 48 01 03 01 50 01 03 00 90 00

我一直在试图了解那个 7D 模板是什么以及我应该如何构建 CDOL,但到目前为止一无所获。我希望有更多经验的人可以帮助我。

获取处理选项

根据“EMV Book 3 - Application Specification”,标记 0x80 格式 1 获取处理选项 的回复包含:

  • x82:应用程序交换配置文件(AIP),
  • x94:应用程序文件定位器(AFL)。

请记住,不同的 APDU 命令的标记 0x80 格式是不同的。

您的 APDU 数据回复带有 EMV TLV 标签 0x80 格式 1 数据包含(2 个字节)带有 AIPAFL 以及 3 条记录(每个4字节,共12字节):

TLVs:  # EMV, Tag + Length + Value (TLV) series
- x80:  # EMV, Template, Response Message Format 1
   tag: "80"
   len: "0E" #   // 14
   val: "7D00400101004801030150010300" # Template, Response Message Format 1.
   - AIP:  # Application Interchange Profile, Tag 0x82
       B01: "7D"
           # _1______ - bit 7, SDA supported
           # __1_____ - bit 6, DDA supported
           # ___1____ - bit 5, Cardholder verification is supported
           # ____1___ - bit 4, Terminal Risk Management is to be performed
           # _____1__ - bit 3, Issuer Authentication is supported
           # _______1 - bit 1, Combined DDA/AC Generation is supported
       B02: "00" # RFU
   - AFL:  # Application File Locator, Tag 0x94
    - S1:  # AFL Record
       B01: "40" # SFI [xxxxx___]  // 8
       B02: "01" # From record  // 1
       B03: "01" # To record  // 1
       B04: "00" # First hashed
    - S2:  # AFL Record
       B01: "48" # SFI [xxxxx___]  // 9
       B02: "01" # From record  // 1
       B03: "03" # To record  // 3
       B04: "01" # First hashed  // 1
    - S3:  # AFL Record
       B01: "50" # SFI [xxxxx___]  // 10
       B02: "01" # From record  // 1
       B03: "03" # To record  // 3
       B04: "00" # First hashed

数据对象列表 (DOL)

在同一 EMV Book 3 中定义的 EMV 数据对象列表 (DOL) 的格式。 在 EMV 世界中使用了几个 DOL 标签。例如:

  • x8C:卡片风险管理 DOL 1 (CDOL1),
  • x8D:卡片风险管理 DOL 2 (CDOL2),
  • x97: 交易证书 DOL (TDOL),
  • x9F38:处理选项 DOL (PDOL),
  • x9F49:动态数据对象列表(DDOL)。

所有 DOL 标签遵循相同的格式规则 - 标签值包含 系列 of Tag_ID + 长度 字节,不含值部分。

带有 CDOL1 的示例 - 标记 0x8C,长度 0x15(21 字节)和值解析。

https://iso8583.info/cmd/EMV/TLVs?8C159F02069F03069F1A0295055F2A029A039C019F3704

---
TLVs:#"8C159F02069F03069F1A0295055F2A029A039C019F3704" # EMV, Tag + Length + Value (TLV) series
- x8C:#"8C159F02069F03069F1A0295055F2A029A039C019F3704" # EMV, Card Risk Management DOL 1 (CDOL1)
  - tag: "8C"
  - len: "15" #  // 21
  - val:#"9F02069F03069F1A0295055F2A029A039C019F3704" # Card Risk Management DOL 1 (CDOL1).
    - x9F02:#"9F0206" # EMV, Authorised Amount (Numeric)
      - tag: "9F02"
      - len: "06"
    - x9F03:#"9F0306" # EMV, Amount, Other (Numeric)
      - tag: "9F03"
      - len: "06"
    - x9F1A:#"9F1A02" # EMV, Country Code, Terminal
      - tag: "9F1A"
      - len: "02"
    - x95:#"9505" # EMV, Terminal Verification Results (TVR)
      - tag: "95"
      - len: "05"
    - x5F2A:#"5F2A02" # ISO 7816, Currency Code, Transaction
      - tag: "5F2A"
      - len: "02"
    - x9A:#"9A03" # EMV, Date, Transaction
      - tag: "9A"
      - len: "03"
    - x9C:#"9C01" # EMV, Transaction Type
      - tag: "9C"
      - len: "01"
    - x9F37:#"9F3704" # EMV, Unpredictable Number
      - tag: "9F37"
      - len: "04"

CDOL1 标签描述了 标签列表 及其 长度 真实 Values 需要包含在 First GENERATE APPLICATION CRYPTOGRAM (AC) APDU 请求数据中。

生成应用程序密码 (AC)

首次生成 AC 命令的智能卡 APDU 请求数据包含 值系列,在 CDOL1 中提到。 CDOL2 用于二次生成 AC。

这是响应中生成 AC APDU 命令和标记 0x80 格式 1 模板的示例(与生成 AC 命令相关)。

> 80 AE 80 00 1D 000000001000 000000000000 0442 0000000000 0978 150310 00 11223344
< 80 12 80 0001 0102030405060708 06010A03A40000 9000

AE: # EMV, Generate AC
- rq:  # ISO 7816-3, Case 4
   CLA: "80" # Class byte
   INS: "AE" # Instruction
 - P1P2:  # Parameters 1 and 2
  - P1: "80" # Parameter 1
       # 10______ - bits 8-7, Authorisation Request Cryptogram (ARQC)
    P2: "00" # Parameter 2
 - LcData: 
    len: "1D" # // 29
  - val: "0000000010000000000000000372000000000009781112120000000000"
     x9F02: "000000001000" # EMV, Authorised Amount (Numeric) // 100
     x9F03: "000000000000" # EMV, Amount, Other (Numeric) // 0
     x9F1A: "0442" # EMV, Country Code, Terminal // 442 - Luxembourg
     x95: "0000000000" # EMV, Terminal Verification Results (TVR)
     x5F2A: "0978" # ISO 7816, Currency Code, Transaction // 978 - euro
     x9A: "150310" # EMV, Date, Transaction.  // 2015.03.10
     x9C: "00" # EMV, Transaction Type.  // Purchase / Sale
     x9F37: "11223344" # EMV, Unpredictable Number
- rs:  # Response
 - SW1SW2:  # Status byte 1 and 2
    SW1: "90" # Status byte 1  // Normal processing
    SW2: "00" # Status byte 2
 - DATA:
  - x80: 
     tag: "80"
     len: "12" #   // 18
   - val:  # Template, Response Message Format 1.
    - x9F27:  # EMV, Cryptogram Information Data (CID)
       val: "80" # Cryptogram Information Data (CID).
       # 10______ - bits 8-7, ARQC
       # _____000 - bits 3-1 (Reason/Advice/Referral Code), No information given
     + x9F36: "0001" # EMV, Application Transaction Counter (ATC)
     + x9F26: "0102030405060708" # EMV, Cryptogram, Application
     + x9F10: "06010A03A40000" # EMV, Issuer Application Data (IAD)

有关 EMV specifications 中程序和流程的更多详细信息可在 EMVCo 站点免费获得。

解析样本是在线完成的EMV and APDU data parsers