Skip to main content

EMV for Python

Tests

A Pythonic implementation of the EMV smartcard protocol, which is used worldwide for chip-and-PIN payments. This is intended to be readable, tested, and heavily cross-referenced with the appropriate sections of the EMV Specification.

This also includes an implementation of the EMV CAP (aka Pinsentry) standard which is known to work for Barclays cards.

Installation

You'll need the pcsc smartcard libraries on your system in order to build the smartcard bindings. On Ubuntu:

sudo apt-get install build-essential swig libpcsclite-dev python-pip python-devel

Then you can install emv from pip:

sudo pip install emv

To check if everything's working, plug in a smartcard reader, put a bank card in, and run:

emvtool info

If all goes well, you should see some data about your card.

Warning

Although this tool has been relatively well tested, it's technically possible to block or even damage your card, as well as get in trouble with your card issuer, using this tool. Please make sure you understand the risks.

Commands marked in the --help output with [!] will initiate a transaction on the card, resulting in a permanent change to the card's internal state which could potentially be detected by your card issuer, particularly if you initiate many transactions.

Command Line

This library ships with emvtool - a simple command-line tool for testing and CAP password generation. To fetch some card metadata, run:

emvtool info

If you have more than one smartcard reader (or smartcard-like devices, such as a YubiKey) connected, you may have to select a specific reader. List all the readers with:

emvtool readers

Then use the -r option to select the specific reader ID, e.g.:

emvtool -r 1 info

To generate an EMV CAP one-time passcode:

emvtool -p <PIN> cap

You can also conduct CAP signing and challenge-response:

emvtool -p <PIN> cap -c <challenge>
emvtool -p <PIN> cap -c <accountno> -a <amount>

EMV is a trademark of EMVCo and is used purely for descriptive purposes. This library is not affiliated with EMVCo.

Metadata

Release files for emv 1.0.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for emv 1.0.14
File Size Uploaded Provenance
emv-1.0.14.tar.gz 21.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for emv 1.0.14
File Interpreter ABI Platform
emv-1.0.14-py3-none-any.whl Python 3 none any Details

Total release size: 44.9 kB

Release files / emv-1.0.14.tar.gz

Download URL emv-1.0.14.tar.gz
Size 21.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e44bd0fbc4696d6b2f14de5e5ce2062de62861152d816276691bae5546a23632
BLAKE2b-256 checksum
How to use checksums
aa15e6a9f1357ba40a768c45714c959e1e3985e6af063bde151fd3974ff60e22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

Release files / emv-1.0.14-py3-none-any.whl

Download URL emv-1.0.14-py3-none-any.whl
Size 23.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
354533d9cb35ac3b658d5372292f3bd2b9246cc68dad3591e094b3bade933ac1
BLAKE2b-256 checksum
How to use checksums
1e67bb6b387ef6d8c50ae002a9275bea7b3ac37d93b6229ef72bacf15e6142d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0

Security for emv 1.0.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page