Trait card_backend::CardTransaction
source · pub trait CardTransaction {
// Required methods
fn transmit(
&mut self,
cmd: &[u8],
buf_size: usize
) -> Result<Vec<u8>, SmartcardError>;
fn feature_pinpad_verify(&self) -> bool;
fn feature_pinpad_modify(&self) -> bool;
fn pinpad_verify(
&mut self,
pin: PinType,
card_caps: &Option<CardCaps>
) -> Result<Vec<u8>, SmartcardError>;
fn pinpad_modify(
&mut self,
pin: PinType,
card_caps: &Option<CardCaps>
) -> Result<Vec<u8>, SmartcardError>;
fn was_reset(&self) -> bool;
// Provided methods
fn select(&mut self, application: &[u8]) -> Result<Vec<u8>, SmartcardError> { ... }
fn max_cmd_len(&self) -> Option<usize> { ... }
}
Expand description
The CardTransaction trait defines communication with a smart card via a backend implementation (e.g. the pcsc backend in the crate card-backend-pcsc), after opening a transaction from a CardBackend.
Required Methods§
sourcefn transmit(
&mut self,
cmd: &[u8],
buf_size: usize
) -> Result<Vec<u8>, SmartcardError>
fn transmit( &mut self, cmd: &[u8], buf_size: usize ) -> Result<Vec<u8>, SmartcardError>
Transmit the command data in cmd
to the card.
buf_size
is a hint to the backend (the backend may ignore it)
indicating the expected maximum response size.
sourcefn feature_pinpad_verify(&self) -> bool
fn feature_pinpad_verify(&self) -> bool
Does the reader support FEATURE_VERIFY_PIN_DIRECT?
sourcefn feature_pinpad_modify(&self) -> bool
fn feature_pinpad_modify(&self) -> bool
Does the reader support FEATURE_MODIFY_PIN_DIRECT?
sourcefn pinpad_verify(
&mut self,
pin: PinType,
card_caps: &Option<CardCaps>
) -> Result<Vec<u8>, SmartcardError>
fn pinpad_verify( &mut self, pin: PinType, card_caps: &Option<CardCaps> ) -> Result<Vec<u8>, SmartcardError>
Verify the PIN pin
via the reader pinpad
sourcefn pinpad_modify(
&mut self,
pin: PinType,
card_caps: &Option<CardCaps>
) -> Result<Vec<u8>, SmartcardError>
fn pinpad_modify( &mut self, pin: PinType, card_caps: &Option<CardCaps> ) -> Result<Vec<u8>, SmartcardError>
Modify the PIN pin
via the reader pinpad
Provided Methods§
sourcefn select(&mut self, application: &[u8]) -> Result<Vec<u8>, SmartcardError>
fn select(&mut self, application: &[u8]) -> Result<Vec<u8>, SmartcardError>
Select application
on the card
sourcefn max_cmd_len(&self) -> Option<usize>
fn max_cmd_len(&self) -> Option<usize>
If a CardTransaction implementation introduces an additional,
backend-specific limit for maximum number of bytes per command,
this fn can indicate that limit by returning Some(max_cmd_len)
.