Git Product home page Git Product logo

emv's Introduction

EMV Tool

EMV provides an easy-to-use interface to interact with EMV smartcards based on this great PCSC rust library.

The acronymim EMV stands for Europay-Mastercard-Visa and describes the behaviour of applications running in smart cards. Most of the specification can be found on Books 1~4 on ./docs/

Installing

Homebrew

Currently only supports macOS

brew tap caiotavares/emv
brew install emv

Building from source

Requires rustup

git clone [email protected]:caiotavares/emv.git
cargo install --path ./emv

Usage

emv <subcommand>

Subcommands

emv currently the following subcommands

subcommand arguments
shell
run <input>

Use shell if you want emv to open a connection with a card and keep listening for APDU commands on the command-line.

If you want emv to run a series of APDU commands with minimal manual input, use run and provide a path for a file with APDU command-syntax.

Supported APDU Commands

Some commands require one or two arguments to be provided and for special cases such as PUT_DATA and PIN_UNBLOCK, emv will prompt the user to input the cryptographic MAC (message authentication code), since these commands modify card information.

APDU Arguments Format Prompts for
SELECT <aid> <hex string>
GET_PROCESSING_OPTIONS
READ_RECORD <record> <sfi> <hex string> <hex string>
GET_DATA <tag> <hex string>
PUT_DATA <tag> <value> <hex string> MAC
GENERATE_AC <type> <cdol> ARQC/TC/ACC <hex string>
PIN_UNBLOCK MAC
PIN_CHANGE* <pin> <hex_string> MAC
VERIFY <pin> <hex_string>

* The input PIN should be encrypted by the SMC key

Example 1: Selecting a Mastercard Credit application, fetching the processing options and requesting an ARQC based on a CDOL1:

$ emv shell
> SELECT A0000000041010
> GET_PROCESSING_OPTIONS
> GENERATE_AC ARQC 0000000000100000000000100986000000000009861504280030901B6A2300001EABC126F85499760000000000000000000000000000000000000000000000000000

Example 2: Selecting a Mastercard Maestro application, fetching the processing options, requesting an ARQC and finally requesting a TC from a CDOL2:

$ emv shell
> SELECT A0000000043060
> GET_PROCESSING_OPTIONS
> GENERATE_AC ARQC 0000000000100000000000100986000000000009861504280030901B6A2300001EABC126F85499760000000000000000000000000000000000000000000000000000 
> GENERATE_AC TC E014E254B75DBB8D031A3030000000000030901B6A1EABC126F8549976

Example 3: Using a PUT DATA command to update a linked application:

$ emv shell
> SELECT A0000000043060
> GET_PROCESSING_OPTIONS
> GENERATE_AC ARQC 0000000000100000000000100986000000000009861504280030901B6A2300001EABC126F85499760000000000000000000000000000000000000000000000000000 
> GENERATE_AC TC E014E254B75DBB8D031A3030000000000030901B6A1EABC126F8549976
> PUT_DATA DF07 00FF07A000000004101000A5500A4D6173746572636172648701035F2D067074656E65739F1101019F120D4372656469746F204A6169726FBF0C159F5D030100009F4D020B0A9F6E0700760000303000
> Input the MAC: 31E9601F158651AD

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.