Metadata-Version: 2.1
Name: smartleia
Version: 1.0.2
Summary: Python toolkit for LEIA smartcard reader
Author: LEIA Team
Author-email: leia@h2lab.org
License: LGPL-2.1+
Project-URL: homepage, https://h2lab.org/devices/leia/quickstart/
Project-URL: repository, https://github.com/h2lab/smartleia
Requires-Python: ==3.*,>=3.6.0
License-File: LICENSE.bsd3
License-File: LICENSE.lgpl-2.1+
License-File: AUTHORS
Requires-Dist: pyserial ==3.*,>=3.4.0
Provides-Extra: dev
Requires-Dist: dephell ==0.*,>=0.8.3 ; extra == 'dev'
Requires-Dist: black ==19.*,>=19.10.0.b0 ; extra == 'dev'
Requires-Dist: bump2version ==1.*,>=1.0.0 ; extra == 'dev'
Requires-Dist: coverage ==5.*,>=5.1.0 ; extra == 'dev'
Requires-Dist: flake8 ==3.*,>=3.7.9 ; extra == 'dev'
Requires-Dist: ipython ==7.*,>=7.14.0 ; extra == 'dev'
Requires-Dist: mypy ==0.*,>=0.770.0 ; extra == 'dev'
Requires-Dist: nbsphinx ==0.*,>=0.7.0 ; extra == 'dev'
Requires-Dist: pandoc ==1.*,>=1.0.2 ; extra == 'dev'
Requires-Dist: pre-commit ==2.*,>=2.3.0 ; extra == 'dev'
Requires-Dist: pylint ==2.*,>=2.5.2 ; extra == 'dev'
Requires-Dist: pytest-runner ==5.*,>=5.2.0 ; extra == 'dev'
Requires-Dist: recommonmark ==0.*,>=0.6.0 ; extra == 'dev'
Requires-Dist: sphinx ==3.*,>=3.0.0 ; extra == 'dev'
Requires-Dist: sphinx-autodoc-typehints ==1.*,>=1.10.3 ; extra == 'dev'
Requires-Dist: sphinx-rtd-theme ==0.*,>=0.5.0 ; extra == 'dev'
Requires-Dist: sphinxcontrib.spelling ==5.*,>=5.0.0 ; extra == 'dev'
Requires-Dist: sphinxcontrib.wavedrom ==2.*,>=2.1.0 ; extra == 'dev'
Provides-Extra: test
Requires-Dist: pytest ==5.*,>=5.2.0 ; extra == 'test'
Requires-Dist: pytest-csv ==2.*,>=2.0.2 ; extra == 'test'


[![GitHub license](https://img.shields.io/github/license/h2lab/smartleia)](https://github.com/h2lab/smartleia/blob/master/LICENSE.bsd3) [![Debian package](https://img.shields.io/debian/v/smartleia/unstable)](https://tracker.debian.org/pkg/smartleia) ![Build status](https://github.com/h2lab/smartleia/actions/workflows/main.yml/badge.svg)


# SmartLeia

This repository holds the source of the python package used to drive the LEIA
smartcard reader. With it, you will be able to:

    - Connect to the LEIA board
    - Choose parameters for the PSS/PTS negotiation
    - Send APDUs and receive the corresponding responses
    - Activate the DFU mode to download new firmware
    - Start a [Virtual SmartCard](https://frankmorgner.github.io/vsmartcard/) 
      client to use LEIA as a real smartcard reader (through pcscd)

The smartleia package should be compatible with **Python 3.6 and newer**.

## Installation

### From apt

If you use debian or ubuntu, smartleia should be packaged (in the
recent versions of the distros). Simply try:

```sh
apt install smartleia
```

### From git


You may need to use the last version of python builtin's setuptools to install
smartleia from git:

```sh
python -m pip install --upgrade pip setuptools wheel
```

```sh
git clone https://github.com/h2lab/smartleia
cd smartleia
pip install --user .;
```

## Using smartleia with PCSC

It is possible to use smartleia in a PCSC mode, where
it communicates with the PCSC daemon so that you can
use your existing tools (such as `opensc`) to communicate
with the smartcard transparently. Using this mode will require
the installation of `vsmartcard-vpcd` and `vsmartcard-vpicc`,
either from the sources in the [vsmartcard](https://github.com/frankmorgner/vsmartcard)
repository, or from your distro packages (this should be
packaged in recent debian and ubuntu distros):


```sh
apt install vsmartcard-vpcd vsmartcard-vpicc
```

Then, you can lauch PCSC daemon in a terminal:
```sh
pcscd -fad
```

And launch smartleia in PCSC relay mode:
```sh
python3 -m smartleia
```

Of course, you should have your LEIA (or equivalent) board
plugged in using USB as well as a smart card present in the
connector. PCSC should spot a new ATR if everything went fine.
