Skip to content

Deciphering EMV data encoded in the not so basic "basic encoding rules".

License

Notifications You must be signed in to change notification settings

coolbong/emv-bertlv

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is this thing?

A library for deciphering BER TLV data used in EMV (chip card transactions).

You might be wondering what some of the strange characters on a credit card receipt mean. Or you might be trying to achieve certification with Visa, Mastercard or Amex (perhaps even UnionPay).

The tests provide some idea of what kind of data this code can decipher. The EMVCo website has the full (1000+ page) specs. Add to that the Visa, Mastercard and Amex documents.

How might I use it?

In a couple of ways:

  1. As a library in a java (or other JVM language) project doing wonderful things with chip card data.
  2. On the web in a little tool. The code for this tool lives in another repo.
  3. As a command line tool.

From Maven or Gradle

Dependency Information (available from Maven Central):

    <dependency>
        <groupId>io.github.binaryfoo</groupId>
        <artifactId>emv-bertlv</artifactId>
        <version>0.1.6</version>
    </dependency>

To get started decoding call decode() on RootDecoder.

Command Line

The library can be used as an executable jar:

  1. Download the latest jar
  2. Run using java -jar emv-bertlv-x.y.z-shaded.jar

This will dump out some (hopefully) somewhat helpful help output:

Usage Main <decode-type> <value> [<tag-set>]
  <decode-type> is one of
    95: TVR
    9B: TSI
    82: AIP
    8E: CVM List
    9F34: CVM Results
    9F6C: CTQ
    9F66: TTQ
    dol: DOL
    filled-dol: Filled DOL
    constructed: TLV Data
    apdu-sequence: APDUs
    bit-string: Bits
  <value> is the hex string or '-' for standard input
  <tag-set> is one of [EMV, qVSDC, MSD, Amex] defaults to EMV

For example to decode the Terminal Verification Results:

java -jar emv-bertlv-x.y.z-shaded.jar 95 ffffffffff

Or say you have a file containing a set of APDUs encoded as hex strings:

cat apdus.txt | java -jar emv-bertlv-x.y.z-shaded.jar apdu-sequence - 

Domain Knowledge

Visa's chip terms explained document is a good list.

Eftlab's knowledge base.

Alternative Tools

Eftlab's BP-Tools

Emvlab's tlvtool

About

Deciphering EMV data encoded in the not so basic "basic encoding rules".

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Kotlin 51.1%
  • Java 48.7%
  • Groovy 0.2%