Skip to main content

This project provides an async (anyio) interface to communicate with the pcscd 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:

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.

Release files for chipcard 0.1.0

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

Built distribution (wheel)

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

Release files / chipcard-0.1.0-py3-none-any.whl

Download URL chipcard-0.1.0-py3-none-any.whl
Size 18.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a015c316d9bf62606eb02b7d83084b9dd7c2e4298feef422a2b093c735b141b3
BLAKE2b-256 checksum
How to use checksums
e705c9a815176d4ac102e9021be0a1ebbd74a498ab679e2c7bf6987841623d2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.8.7rc1 Linux/5.9.0-4-amd64

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file

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