This is an early version library, everything can break at any moment.
Smartcard-rs
This library enables communication between a PC and a smartcard (SC), using PC/SC drivers.
How to use this library
Add the crate
In your Cargo.toml:
[]
= "0.3"
In your main.rs or lib.rs:
extern crate smartcard;
Example code
In the main.rs:
extern crate smartcard;
use Context;
use ;
use *;
use Arc;
Supported platform and dependencies
The pcsc-sys crate is used to link with the drivers. It should work on Linux, Windows and MacOS but I only tested it on Linux.
On ubuntu based systems:
sudo apt-get install pcscd libpcsclite1
Optionnally you can install the always useful pcsc-tools package:
sudo apt-get install pcsc-tools
With this tools you can detect your readers with
pcsc_scan
PRs welcome.
Alternatives
You can check pcsc-rust for another library with the same goal. I reused the pcsc-sys crate from this project for the lib bindings (starting from smartcard-rs v 0.3.0 ). pcsc-rust should have better performances than smartcard-rs at the cost of a slightly less ergonomic API (in my opinion). In pcsc-rust the Card and Context are linked with lifetimes to prevent inappropriate Context dropping (instead of Arc in smartcard-rs case), which can cause self borrowing issues in some applications.