I'm trying to construct a generate AC command for a Mastercard contactless card. I believe I have correctly read the information the card requires for this, from the CDOL1, and send it, with the correct length in a Generate AC command, however the correct is replying with a 6700 (wrong length command). Any advice on what the problem is would be very much appreciated.
The CDOL1 provide by the card is:
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)
For which I'm providing the values
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
which is a total of 60 (3C) bytes, adding the Gen AC header and the Le my message is then:
80AE50003C000000000100000000000000082600000000000826190819003357A30A21000000000000000000001F03021205050000000000000000000000000000
However, the card always returns 6700, which as I understanding it indicates the wrong length. I've tried some other values and dropping the Le, however, I don't see how these could affect the length.
A full trace of my run (with some values Xed out) is:
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
I would have expected the reply to the final command to be the AC, or an error with one of the inputs, not a 6700 length error message.