BP-Tools: EMV Tool

 

BP-Tools icon

Introduction

The BP-Tools set consist of applications supporting payment transaction service development, testing and benchmarking. It currently consists of following components: Cryptographic Calculator, EMV Tool, HSM Commander and P3 Card Edit Tool.

EFTlab distributes BP-Tools under Creative Commons Legal Code Attribution-NoDerivs 3.0 Unported and completely free. This package comes with a full support and monthly releases instantly bringing new features.

This tutorial focuses on EMV Tool functionality and is particularly handy when working with products like from FIME or payment transaction data field like ISO8583-1993 DE55.

EMV Tool (BP-EMVT)

BP-EMVT provides a set of handy analytic functions to any development related to EMV technology regardless it is contact or contactless. EMT Tool has following features: ATR data parser, TLV data parser, EMV tag dictionary and APDU response query.

ATR data parser

The Answer To Reset (ATR) is a message output by a contact Smart Card conforming to ISO/IEC 7816 standards, following electrical reset of the card's chip by a card reader. The ATR conveys information about the communication parameters proposed by the card, and the card's nature and state.

The presence of an ATR is often used as a first indication that a Smart Card appears operative, and its content examined as a first test that it is of the appropriate kind for a given usage.

ATR data parser parses SmartCard's Answer to Reset Data into human readable form.

Note that application input is written to remove all non-hexadecimal characters and is not case sensitive.

Example ATR data input:

3B 6D 00 00 00 31 C0 71 D6 64 19 16 01 02 84 90 00
Output:
****************************************
Data: 3B 6D 00 00 00 31 C0 71 D6 64 19 16 01 02 84 90 00
----------------------------------------
Output:
TS = 0x3B
T0 = 0x6D
    Y(1): b01101101
    K: 13 (Historical Bytes)
TB(1) = 0x00
    VPP is not electrically connected
TC(1) = 0x00
    Extra guard time: 0
Historical Bytes: compact TLV data object):
    Tag: 3, Len: 1 (card service data byte):
        Card service data byte:
            Application selection: by full DF name
            Application selection: by partial DF name
            EF.DIR and EF.ATR access services:
                by the READ RECORD (S) command (record structure)
            Card with MF
    Tag: 7, Len: 1 (card capabilities):
        Selection methods: D6
            DF selection by full DF name
            DF selection by partial DF name
            DF selection by file identifier
            Short EF identifier supported
            Record number supported
    Tag: 6, Len: 4 (pre-issuing data):
        Data: 19 16 01 02 "...."
    Mandatory status indicator (3 last bytes):
        LCS (life card cycle): Proprietary
        SW SW: 90 00
----------------------------------------

TLV data parser

This feature parses EMV data into human-readable form.

Input field takes TLV data in hexadecimal form while output options are a tree and text form. Tree form is easy to navigate though, where the text form output makes easier to handle output data (copy & paste). The EMV parser code as implemented by this tool is also employed for EMV data send/received by EFTlab's BP-Source and BP-Host suites doing same work to its users.

TLV parser expects data to start with an EMV tag followed by length and value. Parser can handle invalid inputs as well so it will provide warning on data parsing error. Tree output from this parser can be seen on a picture located on right, while its text form is below.

Example TLV data:

8C 20 9F 02 06 9F 03 06 9F 1A 02 95 05 5F 2A 02
9A 03 9C 01 9F 37 04 9F 35 01 9F 45 02 9F 34 03
9B 02 8D 08 91 0A 8A 02 95 05 9B 02 8E 10 00 00
00 00 00 00 00 00 5F 03 41 03 5E 03 02 03
Output:
----------------------------------------
Data:
8C 20 9F 02 06 9F 03 06 9F 1A 02 95 05 5F 2A 02
9A 03 9C 01 9F 37 04 9F 35 01 9F 45 02 9F 34 03
9B 02 8D 08 91 0A 8A 02 95 05 9B 02 8E 10 00 00
00 00 00 00 00 00 5F 03 41 03 5E 03 02 03
----------------------------------------
Output:
Card Risk Management Data Object List 1 (CDOL1) [8C]:
    Amount, Authorised (Numeric) [9F02]:
        Length:    06
    Amount, Other (Numeric) [9F03]:
        Length:    06
    Terminal Country Code [9F1A]:
        Length:    02
    Terminal Verification Results (TVR) [95]:
        Length:    05
    Transaction Currency Code [5F2A]:
        Length:    02
    Transaction Date [9A]:
        Length:    03
    Transaction Type [9C]:
        Length:    01
    Unpredictable Number (UN) [9F37]:
        Length:    04
    Terminal Type [9F35]:
        Length:    01
    Data Authentication Code [9F45]:
        Length:    02
    Cardholder Verification Method (CVM) Results [9F34]:
        Length:    03
    Transaction Status Information [9B]:
        Length:    02
Card Risk Management Data Object List 2 (CDOL2) [8D]:
    Issuer Authentication Data [91]:
        Length:    0A
    Authorisation Response Code (ARC) [8A]:
        Length:    02
    Terminal Verification Results (TVR) [95]:
        Length:    05
    Transaction Status Information [9B]:
        Length:    02
Cardholder Verification Method (CVM) List [8E]:
    Data (Binary):     00 00 00 00 00 00 00 00 5F 03 41 03 5E 03 02 03
    00000000 - First amount
    00000000 - Second amount
    CVM #1:            5F 03
    Code:          5F - No CVM required
    Condition:     03 - If terminal supports the CVM
    Next:              Apply succeeding CV Rule if this CVM is unsuccessful
    CVM #2:            41 03
    Code:          41 - Plaintext PIN verification performed by ICC
    Condition:     03 - If terminal supports the CVM
    Next:              Apply succeeding CV Rule if this CVM is unsuccessful
    CVM #3:            5E 03
    Code:          5E - Signature (paper)
    Condition:     03 - If terminal supports the CVM
    Next:              Apply succeeding CV Rule if this CVM is unsuccessful
    CVM #4:            02 03
    Code:          02 - Enciphered PIN verified online
    Condition:     03 - If terminal supports the CVM
    Next:              Fail cardholder verification if this CVM is unsuccessful
----------------------------------------

EMV tag dictionary

Functionality given by this feature is to provide standalone dictionary of all EMV tags. This can be found handy when analyzing an EMV product in secured environments with a limited access to the Internet and to avoid wasting resources on constant manual look up through the EMV documentation. Dictionary's search options include searching through "All text data" to list dependencies on related tags; Tags only; searching through Tag names and their descriptions and listing only Tags with matching templates.

Some tags lodged in database also contain "Example" and "Comment" fields, providing additional information on how field values should look like and field practical usage.

Output for '9F3A':

Search result(s) for '9F3A':
----------------------------------------
Tag:             9F3A
Name:            Amount, Reference Currency
Kernel:          Generic
Source:          Terminal
Format:          binary
Template:        N/A
Length:          4 [B]
Description:     Authorised amount expressed in the reference currency
----------------------------------------
Output for 'Transaction Amount':
Search result(s) for 'Transaction Amount':
----------------------------------------
Tag:             9F54
Name:            Cumulative Total Transaction Amount Limit (CTTAL)
Kernel:          Generic
Source:          ICC
Format:          binary
Template:        N/A
Length:          Variable
Description:     
----------------------------------------
Tag:             9F5C
Name:            Cumulative Total Transaction Amount Upper Limit (CTTAUL)
Kernel:          Generic
Source:          ICC
Format:          binary
Template:        N/A
Length:          Variable
Description:     
----------------------------------------
Tag:             9F75
Name:            Cumulative Total Transaction Amount Limit-Dual Currency
Kernel:          Generic
Source:          ICC
Format:          H
Template:        N/A
Length:          Variable
Description:     
----------------------------------------
Tag:             N/A
Name:            Transaction Amount
Kernel:          Generic
Source:          Terminal
Format:          n 12
Template:        N/A
Length:          6 [B]
Description:     Clearing amount of the transaction, including tips and other adjustments
Example:         000000001000
----------------------------------------

APDU response query

EMV Tool's last screen provides a simple APDU response look up option. Basic list of supported APDU responses is in a table referenced here, but it might be also handy to have it available when there is no Internet connection available as those are not common attachment to the EMV specifications and differs per payment network.

Output for '6800':

SW1 SW2 [6800] - No information given (The request function is not supported by the card)

Summary

In this article, we went through the functionality of EMV Tool.

EMV Tool and other tools covered in BP-Tools suite were designed to help and assist payment industry people in their day to day tasks and make their work the most effective. Our team would be grateful if you would suggest any improvements to our applications or report completely new functionality needed. Feedback from our users like this is exactly what drives the development of its and helps us to share our experience to wide public.

BP-Tools

BP-Tools is a set of freeware applications for EFT testing, benchmarking and transaction service development.

See more...

Download...

Download Flyer...

BP-Sim

The Babylon Payments Simulator (BP-Sim) is a family of highly efficient regression and stress testing tools, designed for deployment in development and pre-production environments. BP-Sim allows users to perform an extensive range of tests across the chain of payment services.

See more...

Download Flyer...

BP-Processing

The Babylon Payments Processing Suite(BP-Processing) is a suite of EFTlab's products for realtime payment transaction processing and authorisation.

See more...