Note
EMV ®️ is a registered trademark in the U.S. and other countries and an unregistered trademark elsewhere. The EMV trademark is owned by EMVCo, LLC. This project refers to "EMV" only to indicate the specifications involved and does not imply any affiliation, endorsement or sponsorship by EMVCo in any way.
This project is a partial implementation of the EMVCo specifications for card payment terminals. It is mostly intended for validation and debugging purposes but may eventually grow into a full set of EMV kernels.
If you wish to use these libraries for a project that is not compatible with the terms of the LGPL v2.1 license, please contact the author for alternative licensing options.
See usage for more examples.
- For Ubuntu 20.04 LTS (Focal), 22.04 LTS (Jammy), or 24.04 LTS (Noble) install the appropriate release package
- For Fedora 41 or Fedora 42, install the appropriate Fedora release package
- For Gentoo, use the
OpenEMV overlay, set the
keywords and useflags as needed, and install using
emerge --verbose --ask emv-utils - For MacOS with Homebrew, use the
OpenEMV tap and install using
brew install openemv/tap/emv-utils - For Windows, use the installer or follow the build instructions below to build using MSYS2
- For other platforms, architectures or configurations, follow the build instructions below
- C11 and C++11 compilers such as GCC or Clang
- CMake
- pkg-config
- iso-codes
- json-c
- Boost.Locale will be used by default for ISO 8859 support but is optional if a different implementation is selected; see ISO/IEC 8859 support.
- iconv can optionally be selected for ISO 8859 support; see ISO/IEC 8859 support.
emv-decodeandemv-toolwill be built by default and requireargp(either via Glibc, a system-provided standalone, or downloaded during the build from libargp; see MacOS / Windows). Use theBUILD_EMV_DECODEandBUILD_EMV_TOOLoptions to preventemv-decodeandemv-toolfrom being built and avoid the dependency onargp.emv-toolrequires PC/SC, either provided byWinSCardon Windows or by PCSCLite on Linux/MacOS. Use theBUILD_EMV_TOOLoption to preventemv-toolfrom being built and avoid the dependency on PC/SC.emv-viewercan optionally be built if Qt (see Qt for details) is available at build-time. If it is not available,emv-viewerwill not be built. Use theBUILD_EMV_VIEWERoption to ensure thatemv-viewerwill be built.- Doxygen can optionally be used to generate API documentation if it is available; see Documentation
- bash-completion can optionally
be used to generate bash completion for
emv-decodeandemv-tool - NSIS can optionally be used to generate a Windows installer for this project
This project also makes use of sub-projects that must be provided as git
submodules using git clone --recurse-submodules:
This project uses CMake and can be built using the usual CMake steps.
To generate the build system in the build directory, use:
cmake -B buildTo build the project, use:
cmake --build buildConsult the CMake documentation regarding additional options that can be specified in the above steps.
The tests can be run using the test target of the generated build system.
To run the tests using CMake, do:
cmake --build build --target testAlternatively, ctest
can be used directly which also allows actions such as MemCheck to be
performed or the number of jobs to be set, for example:
ctest --test-dir build -T MemCheck -j 10If Doxygen was found by CMake, then HTML documentation can be generated using
the docs target of the generated build system.
To generate the documentation using CMake, do:
cmake --build build --target docsAlternatively, the BUILD_DOCS option can be specified when generating the
build system by adding -DBUILD_DOCS=YES.
If the required packaging tools were found (dpkg and/or rpmbuild on Linux)
by CMake, packages can be created using the package target of the generated
build system.
To generate the packages using CMake, do:
cmake --build build --target packageAlternatively, cpack
can be used directly from within the build directory (build in the above
Build steps).
This is an example of how monolithic release packages can be built from scratch on Ubuntu or Fedora:
rm -Rf build &&
cmake -B build -DCMAKE_BUILD_TYPE="RelWithDebInfo" -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=YES -DBUILD_DOCS=YES -DCPACK_COMPONENTS_GROUPING=ALL_COMPONENTS_IN_ONE &&
cmake --build build &&
cmake --build build --target packageThis project contains multiple ISO 8859 implementations that can be selected
at build time using the CMake ISO8859_IMPL option. It allows these values:
boost(default): Uses Boost.Locale, is supported on most platforms, is forgiving of unassigned code points, but requires C++.iconv: Uses iconv, is not supported on some platforms, is less forgiving of unassigned code points, but doesn't require C++.simple: Only supports ISO 8859-1, has no dependencies and doesn't require C++.
This project supports Qt 5.12.x, Qt 5.15.x, Qt 6.5.x and Qt 6.8.x (although it
may be possible to use other versions of Qt) when building the emv-viewer
application. However, on some platforms it may be necessary to use the QT_DIR
option (and not the Qt5_DIR nor Qt6_DIR options) or CMAKE_PREFIX_PATH
option to specify the exact Qt installation to be used. For Qt6 it may also be
necessary for the Qt tools to be available in the executable PATH regardless of
the QT_DIR option.
If the Qt installation does not provide universal binaries for MacOS, it will
not be possible to build emv-viewer as a universal binary for MacOS.
On platforms such as MacOS or Windows where static linking is desirable and
dependencies such as argp may be unavailable, the FETCH_ARGP option can be
specified when generating the build system.
In addition, MacOS universal binaries can be built by specifying the desired
architectures using the CMAKE_OSX_ARCHITECTURES option.
This is an example of how a self-contained, static, universal binary can be built from scratch for MacOS:
rm -Rf build &&
cmake -B build -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_BUILD_TYPE="RelWithDebInfo" -DFETCH_ARGP=YES &&
cmake --build buildOn MacOS, a bundle can also be built using the BUILD_MACOSX_BUNDLE option and
packaged as a DMG installer. Assuming QT_DIR is already appropriately set,
this is an example of how a self-contained, static, native bundle and installer
can be built from scratch for MacOS:
rm -Rf build &&
cmake -B build -DCMAKE_BUILD_TYPE="RelWithDebInfo" -DFETCH_ARGP=YES -DBUILD_EMV_VIEWER=YES -DBUILD_MACOSX_BUNDLE=YES &&
cmake --build build --target packageOn Windows, a standalone installation that includes external dependencies can
also be built using the BUILD_WIN_STANDALONE option and packaged using NSIS.
Assuming QT_DIR is already appropriately set to a Qt installation that can
deploy its own dependencies, this is an example of how a self-contained
installer can be built for Windows:
rm -Rf build &&
cmake -B build -DCMAKE_BUILD_TYPE="RelWithDebInfo" -DBUILD_SHARED_LIBS=YES -DFETCH_ARGP=YES -DBUILD_EMV_VIEWER=YES -DBUILD_WIN_STANDALONE=YES &&
cmake --build build --target packageThe available command line options of the emv-decode application can be
displayed using:
emv-decode --helpTo decode ISO 7816-3 Answer-To-Reset (ATR) data, use the --atr option. For
example:
emv-decode --atr 3BDA18FF81B1FE751F030031F573C78A40009000B0To decode EMV TLV data, use the --tlv option. For example:
emv-decode --tlv 701A9F390105571040123456789095D2512201197339300F82025900Alternatively, binary (not ASCII-HEX) EMV TLV data can be read from stdin by
specifying --tlv -. For example:
echo "701A9F390105571040123456789095D2512201197339300F82025900" | xxd -r -p | emv-decoder --tlv -To decode an EMV Data Object List (DOL), use the --dol option. For example:
emv-decode --dol 9F1A029F33039F4005To decode an ISO 3166-1 country code, use the --country option. For example:
emv-decode --country 528To decode an ISO 4217 currency code, use the --currency option. For example:
emv-decode --currency 978To decode an ISO 639 language code, use the --language option. For example:
emv-decode --language frTo decode an ISO 18245 Merchant Category Code (MCC), use the --mcc option.
For example:
emv-decode --mcc 5999To decode ISO 8859 data and print as UTF-8, use the --iso8859-x option and
replace x with the desired ISO 8859 code page. For example:
emv-decode --iso8859-10 A1A2A3A4A5A6A7The emv-decode application can also decode various other EMV structures and
fields. Use the --help option to display all available options.
The emv-viewer application can be launched via the desktop environment or it
can be launched via the command line. The emv-viewer application does not
support the decoding of individual fields like the emv-decode application
does, but does allow the decoding of EMV TLV data in the same manner as the
emv-decode application.
The available command line options of the emv-viewer application can be
displayed using:
emv-viewer --helpTo decode EMV TLV data, use the --tlv option. For example:
emv-viewer --tlv 701A9F390105571040123456789095D2512201197339300F82025900Alternatively, binary (not ASCII-HEX) EMV TLV data can be read from stdin by
specifying --tlv -. For example:
echo "701A9F390105571040123456789095D2512201197339300F82025900" | xxd -r -p | emv-viewer --tlv -- Document
emv-toolusage - Implement high level EMV processing API
- Implement country, currency, language and MCC searching
- Implement Qt plugin for EMV decoding
Copyright 2021-2025 Leon Lynch.
This project is licensed under the terms of the LGPL v2.1 license with the
exception of emv-decode, emv-tool and emv-viewer which are licensed under
the terms of the GPL v3 license.
See LICENSE and
LICENSE.gpl
files.
This project includes crypto as a git submodule and it is licensed under the terms of the MIT license. See LICENSE file.
This project includes mcc-codes as a git submodule and it is licensed under the terms of The Unlicense license. See LICENSE file.
This project may download libargp during the build and it is licensed under the terms of the LGPL v3 license. See LICENSE file.
Note
EMV ®️ is a registered trademark in the U.S. and other countries and an unregistered trademark elsewhere. The EMV trademark is owned by EMVCo, LLC. This project refers to "EMV" only to indicate the specifications involved and does not imply any affiliation, endorsement or sponsorship by EMVCo in any way.