Metadata-Version: 2.1
Name: chipcard
Version: 0.1.0
Summary: Python package to access chipcards
Home-page: https://github.com/joernheissler/chipcard
License: MIT
Keywords: chipcard,pcsc,smartcard,ISO-7816
Author: Jörn Heissler
Author-email: nosuchaddress@joern.heissler.de
Requires-Python: >=3.7,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Security :: Cryptography
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Provides-Extra: docs
Requires-Dist: anyio (>=2.0.2,<3.0.0)
Requires-Dist: asn1crypto (>=1.3.0,<2.0.0)
Requires-Dist: lazy (>=1.4,<2.0)
Project-URL: Repository, https://github.com/joernheissler/chipcard
Description-Content-Type: text/x-rst

Accessing Chip Cards from python
================================
This project provides an async (`anyio <https://github.com/agronholm/anyio>`__) interface
to communicate with the `pcscd <https://pcsclite.apdu.fr/>`__ process.

It's a 100% python implementation, i.e. no C code or C dependencies are involved.

Requirements
------------
* pcscd (``apt install pcscd``)
* Some async event loop, e.g. trio (``venv/bin/pip install trio``)
* A smart card that is reachable through pcscd

Example
-------
Code to generate a signature on OpenPGP card:

.. code-block:: python

    from anyio import run
    from contextlib import suppress
    from chipcard import connect_chipcard
    from chipcard.card.openpgp import OpenPgpCard

    USER_PW = b"123456"

    async def main():
        async with connect_chipcard(OpenPgpCard) as card, card.card.transaction():
            await card.select_openpgp()
            await card.unlock_pw1_sign(USER_PW)
            sig = await card.compute_digital_signature(b"Hello, World!")
            print(sig.hex())

    with suppress(KeyboardInterrupt):
        run(main, backend="trio")


Development status
------------------
It's currently more of a PoC. API needs to be cleaned up a lot and will
probably change in incompatible ways.

Vital features like Secure Messaging are missing entirely.
And eventually high level APIs for existing smart cards should be implemented.

