1 unstable release
0.1.0 | Jul 12, 2022 |
---|
#1382 in Hardware support
8KB
118 lines
vpicc-rs
vpicc
is a Rust interface for vsmartcard. It can be used to connect to the vpcd
daemon and add a virtual smartcard.
License
This project is licensed under the MIT license. Configuration files and
examples are licensed under the CC0 1.0 license. For more
information, see the license header in each file. You can find a copy of the
license texts in the LICENSES
directory.
This project complies with version 3.0 of the REUSE specification.
lib.rs
:
Interface to the vsmartcard daemon.
This crate makes it possible to connect to a vpcd
daemon and add a virtual smartcard by
implementing the VSmartCard
trait.
Examples
Running a dummy smartcard
fn main() -> std::io::Result<()> {
vpicc::connect()?.run(&mut vpicc::DummySmartCard)
}
Running a custom smartcard
struct Card;
impl vpicc::VSmartCard for Card {
fn execute(&mut self, data: &[u8]) -> Vec<u8> {
log::info!("Received APDU: {:x?}", data);
vec![0x90, 0x00] // 9000 == Success
}
}
fn main() -> std::io::Result<()> {
vpicc::connect()?.run(&mut Card)
}
Dependencies
~87KB