构造万事达卡生成 AC 命令时出现问题



我正在尝试为万事达卡非接触式卡构建一个生成AC命令。我相信我已经从 CDOL1 正确读取了卡所需的信息,并在生成 AC 命令中以正确的长度发送它,但是正确的是使用 6700(错误的长度命令(回复。关于问题是什么的任何建议将不胜感激。

该卡提供的 CDOL1 是:

8C | len:27    Card Risk Management Data Object List 1 (CDOL1)
9F02 | len:06   Amount, Authorised (Numeric)
9F03 | len:06   Amount, Other (Numeric)
9F1A | len:02   Terminal Country Code
95 | len:05   Terminal Verification Results
5F2A | len:02   Transaction Currency Code
9A | len:03   Transaction Date
9C | len:01   Transaction Type
9F37 | len:04   Unpredictable Number
9F35 | len:01   Terminal Type
9F45 | len:02   Data Authentication Code
9F4C | len:08   ICC Dynamic Number
9F34 | len:03   Cardholder Verification Method (CVM) Results
9F21 | len:03   Transaction Time HHMMSS
9F7C | len:14   Customer Exclusive Data (CED)

我为此提供值

Amount, Authorised (Numeric)    000000000100
Amount Other (Numeric)          000000000000
Terminal Country Code           0826         
Terminal Verification Results   0000000000   
Transaction Currency Code       0826         
Transaction Date                190819       
Transaction Type                00           
Unpredictable Number            3357A30A
Terminal Type                   21           
Data Authentication Code        0000
ICC Dynamic Number              0000000000000000   
Cardholder Verification Method (CVM) Results 1F0302 
Transaction Time                120505
Customer Exclusive Data (CED)   0000000000000000000000000000

总共 60 (3C( 字节,添加 Gen AC 标头和 Le 我的消息是:

80AE50003C000000000100000000000000082600000000000826190819003357A30A21000000000000000000001F03021205050000000000000000000000000000

但是,该卡始终返回 6700,据我了解,它表示长度错误。我已经尝试了一些其他值并删除了 Le,但是,我看不出这些值如何影响长度。

我的运行的完整跟踪(带有一些值 Xed(是:

Sending 00A404000E325041592E5359532E4444463031
response length: 62
status: 9000
6F | len:3A    File Control Information (FCI) Template
84 | len:14    DF Name: 325041592E5359532E4444463031
A5 | len:28    Proprietary Information
BF0C | len:25    File Control Information (FCI) Issuer Discretionary Data
61 | len:23    Directory Entry
4F | len:7    Application Identifier (AID): A0000000041010
50 | len:10    Application Label: 4D617374657243617264
87 | len:1    Application Priority Indicator: 01
9F0A | len:8    Application Selection Registered Proprietary Data list: 0001050400000000
Sending 00A4040007A0000000041010
response length: 81
status: 9000
6F | len:4D    File Control Information (FCI) Template
84 | len:7    DF Name: A0000000041010
A5 | len:42    Proprietary Information
50 | len:10    Application Label: 4D617374657243617264
9F12 | len:10    Application Preferred Name: 4D617374657243617264
87 | len:1    Application Priority Indicator: 01
9F11 | len:1    Issuer Code Table Index: 01
5F2D | len:2    Language Preference: 656E
BF0C | len:1A    File Control Information (FCI) Issuer Discretionary Data
9F4D | len:2    Log Entry: 0B0A
9F6E | len:7    Form Factor Indicator (qVSDC): 08260000303000
9F0A | len:8    Application Selection Registered Proprietary Data list: 0001050400000000
Sending 80A8000002830000
response length: 22
status: 9000
77 | len:12    Response Message Template Format 2
82 | len:2    Application Interchange Profile: 1980
94 | len:12    Application File Locator: 080101001001010120010200
Sending 00B2011400
response length: 171
status: 9000
70 | len:81    Record Template
9F42 | len:2    Application Currency Code: 0826
5F25 | len:3    Application Effective Date YYMMDD: XXXXXX
5F24 | len:3    Application Expiration Date YYMMDD: XXXXXX
5A | len:8    Application Primary Account Number (PAN): XXXXXXXXXXXXXXXX
5F34 | len:1    Application Primary Account Number (PAN) Sequence Number: 00
9F07 | len:2    Application Usage Control: FF00
9F08 | len:2    Application Version Number: 0002
8C | len:27    Card Risk Management Data Object List 1 (CDOL1)
9F02 | len:06   Amount, Authorised (Numeric)
9F03 | len:06   Amount, Other (Numeric)
9F1A | len:02   Terminal Country Code
95 | len:05   Terminal Verification Results
5F2A | len:02   Transaction Currency Code
9A | len:03   Transaction Date
9C | len:01   Transaction Type
9F37 | len:04   Unpredictable Number
9F35 | len:01   Terminal Type
9F45 | len:02   Data Authentication Code
9F4C | len:08   ICC Dynamic Number
9F34 | len:03   Cardholder Verification Method (CVM) Results
9F21 | len:03   Transaction Time HHMMSS
9F7C | len:14   Customer Exclusive Data (CED)
8D | len:0C    Card Risk Management Data Object List 2 (CDOL2)
91 | len:0A   Issuer Authentication Data
8A | len:02   Authorisation Response Code
95 | len:05   Terminal Verification Results
9F37 | len:04   Unpredictable Number
9F4C | len:08   ICC Dynamic Number
8E | len:14    Cardholder Verification Method (CVM) List: 000000000000000042031E031F03
9F0D | len:5    Issuer Action Code - Default: B450840000
9F0E | len:5    Issuer Action Code - Denial: 0000000000
9F0F | len:5    Issuer Action Code - Online: B470848000
5F28 | len:2    Issuer Country Code: 0826
9F4A | len:1    Static Data Authentication Tag List: 82
57 | len:19    Track 2 Equivalent Data: ...
Sending 00B2010C00
response length: 112
status: 9000
70 | len:6C    Record Template
9F6C | len:2    Card Transaction Qualifiers (CTQ): 0001
9F62 | len:6    PCVC3 Track1 location: 000000380000
9F63 | len:6    PUNATC Track1 location: 00000000E0E0
56 | len:43    Track 1 Equivalent Data: ...
9F64 | len:1    NATC Track1 location: 03
9F65 | len:2    PCVC3 Track2 location: 000E
9F66 | len:2    PUNATC Track2 location: 0E70
9F6B | len:19    Track1 data: ...
9F67 | len:1    NATC Track2 location: 03
Sending 00B2012400
response length: 189
status: 9000
70 | len:81    Record Template
9F47 | len:1    ICC Public Key Expo: 03
9F46 | len:176    ICC Public Key Cert: 8A4...C3
Sending 00B2022400
response length: 229
status: 9000
70 | len:81    Record Template
8F | len:1    Certification Authority Public Key Index: 05
9F32 | len:1    Issuer Public Key Exponent: 03
92 | len:36    Issuer Public Key Remainder: EEAAE75B30426DEB86F113DFD1B53E7D98D6456172ECFA87F83A3E7733341572B1AC1CE9
90 | len:176    Issuer Public Key Certificate: 3E9C8727E2...2FAF87606
Sending  80AE50003C000000000100000000000000082600000000000826190819003357A30A21000000000000000000001F03021205050000000000000000000000000000
response length: 2
Error: 6700

我本来希望对最终命令的回复是 AC,或者其中一个输入的错误,而不是 6700 长度的错误消息。

你读错了 9F7C 的长度。它0x14不是 14 位小数。此卡申请的长度应为 66 (0x42(。

您可能还想知道的是,ICCPK 证书也包含 PAN,因此您还没有充分了解 (516273******2854(。由于您正在尝试进行 CDA 事务,因此您应该在公钥检索期间了解有关该事务的更多信息。

最新更新