Python package to access chipcards
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file chipcard-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: chipcard-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.8.7rc1 Linux/5.9.0-4-amd64
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a015c316d9bf62606eb02b7d83084b9dd7c2e4298feef422a2b093c735b141b3 |
|
MD5 | 5a20f63b9e3ead609fe6946dccfa41ee |
|
BLAKE2b-256 | e705c9a815176d4ac102e9021be0a1ebbd74a498ab679e2c7bf6987841623d2e |