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.
In a couple of ways:
- As a library in a java (or other JVM language) project doing wonderful things with chip card data.
- On the web in a little tool. The code for this tool lives in another repo.
- As a command line tool.
Dependency Information (available from Maven Central):
<dependency>
<groupId>io.github.binaryfoo</groupId>
<artifactId>emv-bertlv</artifactId>
<version>0.1.3</version>
</dependency>
To get started decoding call decode() on RootDecoder.
The library can be used as an executable jar:
- Download the latest jar
- 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 -
Visa's chip terms explained document is a good list.
Eftlab's knowledge base.
Eftlab's BP-Tools
Emvlab's tlvtool