Trait openpgp_card::CardClient[][src]

pub trait CardClient {
    fn transmit(&mut self, cmd: &[u8], buf_size: usize) -> Result<Vec<u8>>;
fn init_caps(&mut self, caps: CardCaps);
fn get_caps(&self) -> Option<&CardCaps>; fn max_cmd_len(&self) -> Option<usize> { ... } }
Expand description

The CardClient trait defines communication with an OpenPGP card via a backend implementation (e.g. the pcsc backend in the crate openpgp-card-pcsc).

Required methods

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.

Set the card capabilities in the CardClient.

Setting these capabilities is typically part of a bootstrapping process: the information about the card’s capabilities is typically requested from the card using the same CardClient instance, before the card’s capabilities have been initialized.

Request the card’s capabilities - apdu serialization makes use of this information (e.g. to determine if extended length can be used)

Provided methods

If a CardClient 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