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§

source

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.

source

fn feature_pinpad_verify(&self) -> bool

Does the reader support FEATURE_VERIFY_PIN_DIRECT?

source

fn feature_pinpad_modify(&self) -> bool

Does the reader support FEATURE_MODIFY_PIN_DIRECT?

source

fn pinpad_verify( &mut self, pin: PinType, card_caps: &Option<CardCaps> ) -> Result<Vec<u8>, SmartcardError>

Verify the PIN pin via the reader pinpad

source

fn pinpad_modify( &mut self, pin: PinType, card_caps: &Option<CardCaps> ) -> Result<Vec<u8>, SmartcardError>

Modify the PIN pin via the reader pinpad

source

fn was_reset(&self) -> bool

Has a reset been detected while starting this transaction?

(Backends may choose to always return false)

Provided Methods§

source

fn select(&mut self, application: &[u8]) -> Result<Vec<u8>, SmartcardError>

Select application on the card

source

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).

Implementors§