Pour comprendre les mécanismes EMV, il est toujours intéressant d’avoir des exemples d’APDU et de dialogues. Ci-dessous, un exemple d’une transaction EMV réussie (achat sans-contact Interac Flash). Inutile de récupérer les infos de la carte, c’est une carte de test invalide dans le monde réel 🙂 PCD identifie les commandes du terminal, PICC les réponses de la carte InteracFlash :
PCD Select File
CLA: 00
INS: A4
P1: 04
P2: 00
Lc: 0E
Data: 32 50 41 59 2E 53 59 53 2E 44 44 46 30 31 // Select PPSE (2PAY.SYS.DDF01)
Le: 00
PICC Successful
Data (46 bytes)
Tag 6F:FCI Template
Length:2C
Value :84 0E 32 50 41 59 2E 53 59 53 2E 44 44 46 30 31
A5 1A BF 0C 17 61 15 4F 07 A0 00 00 02 77 10 10
87 01 01 50 07 49 4E 54 45 52 41 43
Tag 84:Dedicated File (DF) Name
Length:0E
Value :32 50 41 59 2E 53 59 53 2E 44 44 46 30 31
Tag A5:FCI Proprietary Template
Length:1A
Value :BF 0C 17 61 15 4F 07 A0 00 00 02 77 10 10 87 01
01 50 07 49 4E 54 45 52 41 43
Tag BF0C:FCI Discretionary Data
Length:17
Value :61 15 4F 07 A0 00 00 02 77 10 10 87 01 01 50 07
49 4E 54 45 52 41 43
Tag 61:Application Template
Length:15
Value :4F 07 A0 00 00 02 77 10 10 87 01 01 50 07 49 4E
54 45 52 41 43
Tag 4F:Application Identifier
Length:07
Value :A0 00 00 02 77 10 10
Tag 87:Application Priority Indicator
Length:01
Value :01
Tag 50:Application Label
Length:07
Value :49 4E 54 45 52 41 43
ASCII Value:INTERAC
SW1 SW2: 90 00
PCD Select File
CLA: 00
INS: A4
P1: 04
P2: 00
Lc: 07
Data: A0 00 00 02 77 10 10
Le: 00
PICC Successful
Data (62 bytes)
Tag 6F:FCI Template
Length:3C
Value :84 07 A0 00 00 02 77 10 10 A5 31 50 07 49 4E 54
45 52 41 43 87 01 01 9F 38 15 9F 59 03 9F 5A 01
9F 02 06 9F 1A 02 5F 2A 02 9F 37 04 9F 58 01 5F
2D 02 65 6E BF 0C 05 9F 4D 02 0B 14
Tag 84:Dedicated File (DF) Name
Length:07
Value :A0 00 00 02 77 10 10
Tag A5:FCI Proprietary Template
Length:31
Value :50 07 49 4E 54 45 52 41 43 87 01 01 9F 38 15 9F
59 03 9F 5A 01 9F 02 06 9F 1A 02 5F 2A 02 9F 37
04 9F 58 01 5F 2D 02 65 6E BF 0C 05 9F 4D 02 0B
14
Tag 50:Application Label
Length:07
Value :49 4E 54 45 52 41 43
ASCII Value:INTERAC
Tag 87:Application Priority Indicator
Length:01
Value :01
Tag 9F38:Processing Options Data Object List (PDOL)
Length:15
Value :9F 59 03 9F 5A 01 9F 02 06 9F 1A 02 5F 2A 02 9F
37 04 9F 58 01
Tag 9F59:Terminal Transaction Information
Length:03
Tag 9F5A:Terminal transaction Type
Length:01
Tag 9F02:Amount, Authorized (Numeric)
Length:06
Tag 9F1A:Terminal Country Code
Length:02
Tag 5F2A:Transaction Currency Code
Length:02
Tag 9F37:Unpredictable Number
Length:04
Tag 9F58:Merchant Type Indicator
Length:01
Tag 5F2D:Language Preference
Length:02
Value :65 6E
ASCII Value:en
Tag BF0C:FCI Discretionary Data
Length:05
Value :9F 4D 02 0B 14
Tag 9F4D:Log Entry
Length:02
Value :0B 14
SW1 SW2: 90 00
PCD Get Processing Options
CLA: 80
INS: A8
P1: 00
P2: 00
Lc: 15
Data: 83 13 C0 80 00 00 00 00 00 00 10 00 01 24 01 24
82 3D DE 7A 01
Le: 00
PICC Successful
Data (23 bytes)
Tag 77:Response Message Template Format 2
Length:15
Value :82 02 18 00 94 08 08 01 01 00 10 01 02 00 9F 63
04 00 10 00 00
Tag 82:Application Interchange Profile
Length:02
Value :18 00
Tag 94:Application File Locator (AFL)
Length:08
Value :08 01 01 00 10 01 02 00
Tag 9F63:Card Transaction Information
Length:04
Value :00 10 00 00
SW1 SW2: 90 00
PCD Read Record
CLA: 00
INS: B2
P1: 01
P2: 0C
Le: 00
PICC Successful
Data (52 bytes)
Tag 70:Application Elementary File (AEF) Data Template
Length:32
Value :5F 20 1A 49 4E 54 45 52 41 43 2F 20 20 20 20 20
20 20 20 20 20 20 20 20 20 20 20 20 20 57 13 45
19 03 90 00 00 99 89 D1 91 22 20 06 00 00 00 00
00 1F
Tag 5F20:Cardholder Name
Length:1A
Value :49 4E 54 45 52 41 43 2F 20 20 20 20 20 20 20 20
20 20 20 20 20 20 20 20 20 20
ASCII Value:INTERAC/
Tag 57:Track 2 Equivalent Data
Length:13
Value :12 34 56 78 90 12 34 56 D1 91 22 20 06 00 00 00
00 00 1F
SW1 SW2: 90 00
PCD Read Record
CLA: 00
INS: B2
P1: 01
P2: 14
Le: 00
PICC Successful
Data (52 bytes)
Tag 70:Application Elementary File (AEF) Data Template
Length:32
Value :9F 42 02 01 24 9F 44 01 02 5F 25 03 13 01 01 5F
24 03 19 12 31 5F 34 01 01 9F 08 02 00 02 5F 28
02 01 24 5A 08 45 19 03 90 00 00 99 89 5F 30 02
02 20
Tag 9F42:Application Currency Code
Length:02
Value :01 24
Tag 9F44:Application Currency Exponent
Length:01
Value :02
Tag 5F25:Application Effective Date
Length:03
Value :13 01 01
Tag 5F24:Application Expiration Date
Length:03
Value :19 12 31
Tag 5F34:Application PAN Sequence Number
Length:01
Value :01
Tag 9F08:Application Version Number
Length:02
Value :00 02
Tag 5F28:Issuer Country Code
Length:02
Value :01 24
Tag 5A:Application Primary Account Number (PAN)
Length:08
Value :45 19 03 90 00 00 99 89
Tag 5F30:Service Code
Length:02
Value :02 20
SW1 SW2: 90 00
PCD Read Record
CLA: 00
INS: B2
P1: 02
P2: 14
Le: 00
PICC Successful
Data (77 bytes)
Tag 70:Application Elementary File (AEF) Data Template
Length:4B
Value :9F 07 02 AB 00 8C 1E 9F 02 06 9F 03 06 9F 1A 02
95 05 5F 2A 02 9A 03 9C 01 9F 37 04 9F 45 02 9F
4C 08 9F 34 03 8E 0C 00 00 00 00 00 00 00 00 42
00 1F 00 9F 0E 05 00 00 00 00 00 9F 0F 05 FC F8
FC F8 00 9F 0D 05 FC F8 FC 88 40
Tag 9F07:Application Usage Control
Length:02
Value :AB 00
Tag 8C:Card Risk Management Data 1 (CDOL1)
Length:1E
Value :9F 02 06 9F 03 06 9F 1A 02 95 05 5F 2A 02 9A 03
9C 01 9F 37 04 9F 45 02 9F 4C 08 9F 34 03
Tag 9F02:Amount, Authorized (Numeric)
Length:06
Tag 9F03:Amount, Other (Numeric)
Length:06
Tag 9F1A:Terminal Country Code
Length:02
Tag 95:Terminal Verification Results
Length:05
Tag 5F2A:Transaction Currency Code
Length:02
Tag 9A:Transaction Date
Length:03
Tag 9C:Transaction Type
Length:01
Tag 9F37:Unpredictable Number
Length:04
Tag 9F45:Data Authentication Code
Length:02
Tag 9F4C:ICC Dynamic Number
Length:08
Tag 9F34:Cardholder Verification Method (CVM) Results
Length:03
Tag 8E:Cardholder Verification Method (CVM) List
Length:0C
Value :00 00 00 00 00 00 00 00 42 00 1F 00
code = 00:RFU
condition = 00:Always
code = 00:RFU
condition = 00:Always
code = 00:RFU
condition = 00:Always
code = 00:RFU
condition = 00:Always
code = 42:Apply succeeding CVM Rule if this CVM is unsuccessful, Enciphered PIN verification online
condition = 00:Always
code = 1F:Fail cardholder verification if this CVM is unsuccessful, No CVM required
condition = 00:Always
Tag 9F0E:Issuer Action Code - Denial
Length:05
Value :00 00 00 00 00
Tag 9F0F:Issuer Action Code - Online
Length:05
Value :FC F8 FC F8 00
Tag 9F0D:Issuer Action Code - Default
Length:05
Value :FC F8 FC 88 40
SW1 SW2: 90 00
PCD Generate Application Cryptogram
CLA: 80
INS: AE
P1: 80
P2: 00
Lc: 2A
Data: 00 00 00 00 10 00 00 00 00 00 00 00 01 24 80 00
00 80 00 01 24 14 03 20 00 82 3D DE 7A 00 00 00
00 00 00 00 00 00 00 3F 00 02
Le: 00
PICC Successful
Data (47 bytes)
Tag 77:Response Message Template Format 2
Length:2D
Value :9F 27 01 80 9F 36 02 00 39 9F 10 16 15 02 85 04
40 F8 00 61 00 00 B0 10 00 00 C0 80 00 00 01 00
00 00 9F 26 08 C5 B5 54 2C F6 1D A4 06
Tag 9F27:Cryptogram Information Data (CID)
Length:01
Value :80
Tag 9F36:Application Transaction Counter (ATC)
Length:02
Value :00 39
Tag 9F10:Issuer Application Data
Length:16
Value :15 02 85 04 40 F8 00 61 00 00 B0 10 00 00 C0 80
00 00 01 00 00 00
Tag 9F26:Application Cryptogram (AC)
Length:08
Value :C5 B5 54 2C F6 1D A4 06
SW1 SW2: 90 00
Président et fondateur de NeoLegal, développe des solutions logicielles qui facilitent le quotidien des professionnels du droit des sociétés.