Expand description
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)
}Structs§
- Connection
- A connection to the vpcd daemon.
- Dummy
Smart Card - A dummy
VSmartCardimplementation that prints to the log instead of performing any action.
Constants§
- DEFAULT_
ATR - The default ATR used in
DummySmartCard. - DEFAULT_
HOST - The default host used in
connect. - DEFAULT_
PORT - The default port used in
connect.
Traits§
- VSmart
Card - A virtual smartcard implementation.
Functions§
- connect
- Connects to the vpcd dameon using
DEFAULT_HOSTandDEFAULT_PORT. - connect_
socket - Connects to the vpcd daemon at the given address.