Professional Documents
Culture Documents
Decrypt the Issuer Public Key Certi cate File by the CA public Key and get the
Issuer Public Key
Step 1 Done
Using the private key and the ICC public Key Modulus create the ICC Public Key
Certi cate File
SELECT COMMAND
READ RECORD
IF the Application Identi er (ADF Name) (A0000000651010) is known, directly SELECT the ADF
Else select the DDF which will reveal all the APP ID with priority and select the ADF
SELECT using PPSE (2PAY.SYS.DDF01)
fi
APDU - Application Protocol Data Unit
After the reset, the communication between terminal and card works with APDUs.
Command APDU
The terminal sends a command APDU to the card. This command has a
mandatory header and an optional body.
Header Trailer
Field Description
Class byte
CLA 0x00
Instruction byte
INS 0xA4:Select Command
0xB2:Read Record Command
Parameter 1 byte
P1 The function is dependent on INS.
Parameter 2 byte
P2 The function is dependent on INS.
Number of data bytes send to the card.
Lc The value of Lc will be calculated by the terminal. You don't have to state this
parameter.
Data Data byte
Number of data bytes expected in the response. If Le is 0x00, 256 bytes are
Le expected.
Response APDU
The card will execute the command and send a response APDU back to the
terminal. The response APDU has an optional body consisting of data and a
mandatory trailer with two status bytes "SW1" and "SW2". SW1 and SW2
result in a status word (SW). If the status word has the value 0x9000 (SW1 =
0x90, SW2=0x00), the command was successful.
Data SW 1 SW 2
Body Trailer
READ RECORD COMMAND
Code Value
CLA ‘ 00’h
INS ‘B2’h
P1 number of the record to read
P2 xxxxxx (SFI) zzz (P1 – entry number)
Lc Is Missing
Data Is Missing
Le ‘ 00’h
Case 1 to 4
Case 1
Command: Header
Response:Trailer
Case 2
Command: Header + Le
Response:Data + Trailer
Case 3
Command: Header + Data
Response: Trailer
Case 4
Command: Header + Data + Le
Response: Data + Trailer
SELECT COMMAND
Class of the command: 00 C1
Instruction code: A4
Parameter 1: 04
Parameter 2: 00
Field length: 0E
Data: 325041592E5359532E4444463031 (Hex of 2PAY.SYS.DDF01 DDF)
Expected response length: 00
00A404000E325041592E5359532E444446303100
00A404000E325041592E5359532E444446303100
00a404000e325041592e5359532e444446303100
Response
6F3B840E325041592E5359532E4444463031A529BF0C2661244F07A00000006510105016344134333
432323035303732363537303631363936348701019000
6F3B840E325041592E5359532E4444463031A529BF0C2661244F07A0000000651
0105016344134333432323035303732363537303631363936348701019000
6F File Control Information (FCI) Template
325041592E5359532E4444463031
61 Application Template
A0000000651010
50 Application Label
JCB Prepaid
4 A 4 3 4 2 2 0 5 0 7 2 6 5 7 0 6 1 6 9 6 4
01
Application Priority Indicator
Indicates the priority of a given application or group of applications in a directory
A card can have more than 1 apps, the priority one is marked here
fi
6F3B840E325041592E5359532E4444463031A529BF0C2661244F07A0000000651
0105016344134333432323035303732363537303631363936348701019000
6F3b 84 0E
325041592E5359532E4444463031
325041592E5359532E4444463031
A5 29
BF0C 26
61 24
8407A0000000651010
50 16
346134333432323035303732363537303631363936348701
01
SELECT COMMAND (DIRECT AID SELECT)
Class of the command: 00 C2
Instruction code: A4
Parameter 1: 04
Parameter 2: 00
Field length: 07
Data: A0000000651010
Expected response length: 00
00A4040007A000000065101000
Response
6F4D8407A0000000651010A5425016344134333432323035303732
363537303631363936349F38039F52015F2D04363536459F110101
9F1216344134333432323035303732363537303631363936349000
A0000000651010
50 Application Label
4 A 4 3 4 2 2 0 5 0 7 2 6 5 7 0 6 1 6 9 6 4
9F5201
Code table according to ISO/IEC 8859 for
5F2D Language Preference
displaying the Application Preferred Name
Contains a list of terminal resident
6 5 6 E
en
data objects (tags and lengths)
JCB Prepaid
needed by the ICC in processing the
4A43422050726570616964
1 - EMV Mode
3 - Both
[Request] 80A800000383010300
[Response] 770E8202198094081001010010020601
80A800000283010300
fi
fi
770E8202198094081001010010020601
77 E(14) 8202198094081001010010020601
82 2(2) 1980
94 8(8) 1001010010020601
[State] 9000 fi
1980
00011001 1000 0000
0
0 CardHolder
0 Verification id
1 supported
1
0 Terminal Risk
0 Management is to
1
be performed
0080 (Byte 2 Bit 8) EMV and Magstripe Modes Supported
1
0
0
0 Issuer
0
0
Authentication
0
0
Card Action Analysis
Terminal Action Analysis
Floor Limit: If a set amount is exceeded, go online for authorization. (TVR Terminal 1
Veri cation Result bit for Floor Limit will be set to 1)
ffl
ffl
fi
00
00
00 80 1000 0000
1
2
Cardholder Verification is Supported
Contactless CVM (Cardholder Veri cation Methods) limit:
an amount (in minor units) above which the terminal requires a
CVM. cardholder veri cation method (CVM) limit—is the
maximum amount a customer can pay with a contactless card
before they are prompted for a signature or PIN veri cation.
• Contactless currency
Tells you where to get the Issuer Certi cate , ICC Certi cate and
other details, these infos are stored in the IC Card in a AEF identi ed
by SFI (Short File index) has a number
fi
fi
fi
Returned AFL - 1001010010020601
Every 4 bytes stick together. Take the 4 bytes and do the
decoding
10020200 18010701
The ve most signi cant bits are the SFI.The three least
signi cant bits are set to zero. 10 -> 00010000 (SFI - 2)
Start Record : 01
End Record : 01
Start Record : 02 01
End Record : 06 07
The ve most signi cant bits are the SFI.The three least
signi cant bits are set to zero. 10 -> 00010000 (SFI - 2)
Start Record : 02
End Record : 06
AFL - 1001010010020601
00B20114
}
FROM 1 to 1
00B20214
00B20314
00B20414
FROM 2 to 6
00B20514
00B20614
00101 000
COMMANDS TO TERMINAL
“10” - Encode to bits : 0001-0000 , Group first 5 bits
00010,000 -> Add 4 (100) -> out put becomes 00010100 ->
14
00B20214
AFL - 10020200 18010701
00B2011C
}
00011100
FROM 1 to 1
00B2021C
00011100
00B2031C
00101 000
00B2041C
FROM 2 to 6
00B2051C
00B2061C
00B2071C
Cardholder Name
• Discretionary Data = 1900262300000F — so-called «discretionary data» where the values such as CVV/CVV2 can be
encoded.
Tag 5F20: Cardholder Name: 202F — name of the cardholder. It should be mentioned that contactless
cards never contain the cardholder name. It is done for the security purposes. For this reason, tag 5F20 is
either completely missing in the card profile, or has a certain random set of data. In our case, the cardholder
name is = «/».
313930303230303030303030303030363233303030303030 - Hex to String Gives below
190020000000000623000000
1900262300000F
fi
[Command] 00B2021400
5A 8(8) 3571114100152638
8C 1B(27) 9F02069F03069F1A0295055F2A029A039C019F37049F35019F5303
0101 0000
Issuer Action Code - Online, Denial, Default
IAC - Online
If the Terminal has no online ability, the IAC - Default list speci es the issuers's conditions to reject a transaction.
Example:
Byte 1:
Byte 2:
0000000000
Expired application (b7)
Byte 3:
PIN entry required, PIN pad present, but PIN was not entered (b4)
Byte 4:
Byte 5:
If TVR and IAC both have byte four b8 set to 1 the transaction will be rejected.
ffl
fi
fl
fi
fi
IAC - Denial
This speci es the issuer's conditions to reject a transaction.
Byte 1:
Byte 2:
PIN entry required and PIN pad not present or not working (b5)
PIN entry required, PIN pad present, but PIN was not entered (b4)
Byte 4:
Byte 5:
TVR byte two b7 is set to 1 (New Card). This match with byte two b7 from the Issuer Action Code - Online.
As a Result of this the Terminal will decide to proceed the transaction online.
ffl
fi
ff
fl
fi
Application usage control
◦ Bit 8 = 1, Byte 1: Valid for domestic cash transactions;
◦ Bit 7 = 1, Byte 1: Valid for international cash transactions;
◦ Bit 6 = 1, Byte 1: Valid for domestic goods;
◦ Bit 5 = 1, Byte 1: Valid for international goods;
◦ Bit 4 = 1, Byte 1: Valid for domestic services;
◦ Bit 3 = 1, Byte 1: Valid for international services;
2900 Hex
◦ Bit 2 = 1, Byte 1: Valid at ATMs;
◦ Bit 1 = 1, Byte 1: Valid at terminals other than ATMs; 0010 1001
◦ Bit 8 = 1, Byte 2: Domestic cashback allowed;
◦ Bit 7 = 1, Byte 2: International cashback allowed;
◦ Bit 6 · Bit 1, Byte 2: RFU.
9F0206
Tag 9F02, length 06: Transaction Amount.
000000001000
9F0306
Tag 9F03, length 06: Cashback Amount.
000000000000
9F1A02
Tag 9F1A, length 02: Terminal Country Code.
0144
9505
0000008000
5F2A02
Tag 5F2A, length 02: Transaction Currency Code.
0144
9A03
Tag 9A, length 03: Transaction Date.
220106
9C01
Tag 9C, length 01: Transaction Type.
00
9F3704
Tag 9F37, length 04: Unpredictable Number (UN)
0317D95C
9F3501
Tag 9F35, length 01: Terminal Type.
22
9F5303 778000
fi
00
00
00 80 1000 0000
Terminal Type
[Command] 00B203140
6
4705476E184A6E5D250F6E4BCF93D812AAD0E36A7C19A45124CAB0EA50
7F52FABD869EA9F527214A9BC5876466C2BEC3BDEF3A0864F0AFEB4CD
E5CC640972DE24FD4150656B6C495B0D32773DE7E08E23DB41EE7B6AFA
16C6179825FFE19F214CE8C7F8AB48EADA08038D5087E6205B8F5BD4FD
EA6568F68B9EAD46BC4B79FAC56841B0716FA6D75FAD3E9AED4151D578
1D6E4E0695DABBF692F73137E76168D69A761A65EEC105F035B4B337B4
52307C1784A3AE37FA1C6044338E67C0B3D8C876A33544E089EBF978154
B1099B87895DD431A025BE51F3A9B09EB184A90633D7E6E56BB7959FC4
CB51087B3CB2575B266C01F82B5D0246
a2efcca4c837091ef7708097decb0375c6aabdb8f98ac7069e3a581ba064ad8bde7f
1b73bfd25145a8f722371056ceebcfa43b542ba9a77f7abe3422535cfe7d695387f0f
ae18354cb90c39a61e1589592323cfc8ee9547e3863e535870d4df134b79828414a
a88495a18e52d79417097c4947e820489fbd47abd5e3c704f535ca2555d9f31aed3
c9377ee741f38495d614386bf0465bea8d9318517304b7845e53338c140af467fd8e
ecc102de2115d
[Command] 00B2041400
7
8F 1(1) 13
9F32 1(1) 03
9F4A 1(1) 82
8
9F46 B0(176)
863C8631CA5FA16EDDDB29F769AEB2812251BCE2CE9B4E92
44FEA638A3B5E160F0B089A4FB772126BC2B8D1D1D32A85A
0E1F98387B518DED0A38D3460690F00448E74E4D5C727DCB8
05022C24FD3D01EB60DA5D695817758410066502ABAB94370
7584E7AF0629BE91973C397CA230D0B6112C4301CD24E44D
BFAAE8C8A55E0752A5E34B6C57B2AD799854535D474BBA60
B09F486F1B5070B7AA6CFE43154B9EB4DB7A5E7B072CCEE8
E57B5AA13D2723
fi
[Command] 00B2061400
9
[9F47 1(1) 03
9F48 2A(42)
22576A59047E93D5FB1D613D927B98CA29E65C65832B
A725BC0054302A558074223FF6999620806876B3
6a043571114100152638 0124152638010
Certificate Format 1 Hex Value '04' b
1b001c0979fb8dd76a800df35b9c59d9d1ae
Application PAN 10 PAN (padded to the right with cn 20
Hex 'F's)
a918fc135c50e713723fbca0087ae44eae3b
Certificate Expiration Date 2 MMYY after which this n4 6d92931a6689a288cdf1c632fde4617b7cd6
certificate is invalid
fi
ff
f
PART 4
Cryptogram - GENERATE AC + TC
GENERATE APPLICATION CRYPTOGRAM TC + CDA
[Command] P1= Generate TC (01xx) + CDA signature Request (xxx1)= 0101 0000 = 50 CDOL1
80AE500021000000001000000000000000014400000080000144220106000317D95C22778000
9F27 1(1) 40
10
Cryptogram Information Data (CID)
9F4B B0(176)
5005D4FFD77A93ACEFFB5A83E937CFA5EA301391A0287CD3C8BB86F1AAF660F7F243A00E4353E
A51ADB32C57C71F9C9187026ADFAD287AD4688865EF6C35380CF1FFDA7BF4ABFDA0DEF1AE3FC
A614AB4677BFDED704EE075B9066A57426AF69CE4AF315F0BA7F4E60739480388BA274CCF7F6A
63D809462E51281CFB3FD7299C4410C8C1882BB13867C19AC549B35822B34C46047D37ED057CC
779A2FA29278D1FB90F9580B07744F72CE33F41E8016C
9F50 1(1) 00
DS Slot Availability
ffl
ffl
Field Description
Class byte
CLA
0x80
Instruction byte
INS
0xAE: GENERATE CRYPTOGRAM
Parameter 1 byte
P1
The function is dependent on INS 50 (TC -1 , RFU -1)
P2 0
Lc 21 Hex (33)
Data 000000001000000000000000014400000080000144220106000317D95C227
78000
Le Number of data bytes expected in the response. If Le is 0x00, 256 bytes are expected.
The
b7 b6 b5 b4 b3 b2 b1 Meaning
refere
0 0 AAC
0 1 TC
1 0 ARQC
1 1 RFU
x RFU
x x x x RFU
9F0306
Secondary amount cashback amount 000000000000
9F1A02
Indicates the country of the terminal 0144 (SriLanka)
9505
Terminal Veri cation Results 0000008000 Ref Next Page
5F2A02
Transaction Currency Code 0144 (SriLanka)
9A03
Transaction Date 220106
9C01
Transaction Type 00
9F3704
Unpredictable Number 0317D95C
9F3501
Terminal Type 22 Ref Next Page Others Have
0000000000000000 ICC Dynamic Number
9F5303 The dynamic Terminal Interchange Pro le 778000 1F0302 Cardholder Veri cation Method
000000001000 000000000000 0144 0000008000 0144
220106 00 0317D95C 22 778000
fi
fi
fi
Terminal Type - (9F3501) 22
0010 0010
Terminal Veri cation Results 00 00 00 80 00
b b b b b b b b b b b b b b b b
Meaning Meaning
8 7 6 5 4 3 2 1 8 7 6 5 4 3 2 1
Offline data authentication was not Card and terminal have different application
1 1
performed versions
0 RFU 0 RFU
00 00
fi
b8 b7 b6 b5 b4 b3 b2 b1 Meaning
1 Unrecognised CVM
1 PIN entry required, PIN pad present, but PIN was not entered
0 RFU
0 RFU
00
1000 0000
b8 b7 b6 b5 b4 b3 b2 b1 Meaning
0 RFU
0 RFU
0 RFU
80
b8 b7 b6 b5 b4 b3 b2 b1 Meaning
1 1 RFU
00
fi
fi
OUTPUT OF AC GENERATE + TC
f2 d0 41 75 63 9a 33 26 TC
9d be 33 1c 21 b6 0b 17 70 8c 0d 61 74 55 a6 6f e9 d0 26 4a Transaction Data
Hash Code
05
SDAD = signSIC ( nonceIC, CID, AC, TDHC,
01
H(nonceIC, CID, AC, TDHC, nonceTerminal))
26
08
f2 d0 41 75 63 9a 33 26 TC
-The values of the data elements speci ed by, and in the order they appear in the PDOL, and sent by
the terminal in the GET PROCESSING OPTIONS command
- The values of the data elements speci ed by, and in the order they appear in the CDOL1, and sent
by the terminal in the rst GENERATE AC command.
- The tags, lengths, and values of the data elements returned by the ICC in the response to the
GENERATE AC command in the order they are returned, with
9F4B B0(176)
5005D4FFD77A93ACEFFB5A83E937CFA5EA301391A0287CD3C8BB86F1AAF660F7F243A00E4353E
A51ADB32C57C71F9C9187026ADFAD287AD4688865EF6C35380CF1FFDA7BF4ABFDA0DEF1AE3FC
A614AB4677BFDED704EE075B9066A57426AF69CE4AF315F0BA7F4E60739480388BA274CCF7F6A
63D809462E51281CFB3FD7299C4410C8C1882BB13867C19AC549B35822B34C46047D37ED057CC
779A2FA29278D1FB90F9580B07744F72CE33F41E8016C
4 9F50 1(1) 00
DS Slot Availability
fi
ffl
9F50 1(1) 00
1
Cardholder Veri cation Status (k5)
fi
PDOL
80A800000283010300
CDOL
GENERATE APPLICATION CRYPTOGRAM TC + CDA
80AE50002100000000100000000000000001440000008000014
4220106000317D95C22778000
9F27 01 40 9F10 17
9F36 02 0069
160104079040004001452200
9F50 01 00 05000000
9F5F 06 000004762800
830103
000000001000000000000000014400000080000144220106000317D95C2278000
9F270140
9F36020069
9F500100
9F10171601040790400040014522000000237200000005000000
9F5F06000004762800
6a05012608ae4b542e80dfc1404 Field Name Data
0f2d04175639a33269dbe331c21
Recovered Data Header. 6a
b60b17708c0d617455a66fe9d02
Signed Data Format. 5
64abbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbb Hash Algorithm Indicator. 1
7b3550fb285e17593bc
Cryptogram Information Data (CID) - it's 0x40, which
means the AC is an TC
Cryptogram Information Data (CID)
40 - 0100 0000
For b7 b6 b5 b4 b3 b2 b1 Meaning
both
0 0 AAC
0 1 TC
1 0 ARQC
1 1 RFU
x x Payment System-specific cryptogram
0 No advice required
1 Advice required
x x x Reason/advice code
0 0 0 No information given
0 0 1 Service not allowed
0 1 0 PIN Try Limitexceeded
0 1 1 Issuerauthentication failed
1 x x Other values RFU
6a05012608ae4b542e80dfc14040f2d04175639a33269d
be331c21b60b17708c0d617455a66fe9d0264abbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbb7b598e90b5533d4aabebef57b3550fb285e1
7593bc
Hash
Tag 9F37, length
+
04: Unpredictable
05012608ae4b542e80dfc14040f2d04175639a33269dbe331c21b60b17708
c0d617455a66fe9d0264abbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
Number (UN)
7b598e90b5533d4a
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 0317D95C abebef57b3550fb28
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
5e17593
bbbbbbbbbbbbbbbbbb
Issuer Application Data (IAD)
9F10 17(23) 1601040790400040014522000000237200000005000000
16 01 04 07 90 40 00 40 014522 000000237200000005000000
Length - 0x17 - 23
16 01 04 07 90 40 00 40 01 45 22 000000237200000005000000
\
ti
ti
O ine Accumulator Balance
00
‘9F50' 6
O ine Balance
Implementation-Conditional:
If the reader supports manual cash transactions, then this functionality shall be
implemented.
For manual cash transactions, the EMV mode-enabled kernel shall use:
ARQC
ARQC
CARD TERMINAL ISSUER
ARPC
• ARQC: this is the card telling you it needs to know the host
decision before it can give you its nal decision (GO_ONLINE);
the transaction is still in progress waiting for that data.
• AAC: this is the card telling you it made its nal decision, which
is declined, and that you don't need to contact the host
(DECLINE_OFFLINE); the transaction is now over
• TC: this is the card telling you it made its nal decision, which
is approved, and that you don't need to contact the host
(APPROVE_OFFLINE); the transaction is now over.
fi
fi
fi
Important!
If you got ARQC, you send that AC and other relevant tags to
a host for a decision. You may get up to three pieces of
information from the host. The decision (Tag 8A), the Issuer
Authentication Data (Tag 91) and issuer scripts (Tags 71 and
72). Feed this information back to the card with a
completeTransaction call.
The ICC then uses tags in CDOL to generate the second
application AC. This is the card making the final decision, it
can be either AAC (declined) or TC (approved). The
transaction is now over.