Struct yubirs::piv::hal::PcscHardware

source ·
pub struct PcscHardware { /* private fields */ }
Expand description

An implementation of PcscHal which actually talks to real hardware using the PC/SC library.

Implementations§

source§

impl PcscHardware

source

pub fn new_with_recording<P: AsRef<Path>>(output: P) -> Result<Self>

Trait Implementations§

source§

impl Drop for PcscHardware

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl PcscHal for PcscHardware

source§

fn new() -> Result<Self>

Construct a new HAL, ready to connect to / interact with underlying hardware.
source§

fn secure_random_bytes(&self, buf: &mut [u8]) -> Result<()>

Populate the given buffer with cryptographically secure random bytes.
source§

fn cheap_random_bytes(&self, buf: &mut [u8]) -> Result<()>

Populate the given buffer with cheap-to-generate but possibly weak random bytes. NOTE: be extremely careful with using this function in cryptographically sensitive situations.
source§

fn list_readers(&self) -> Result<Vec<String>>

Return a list of the PC/SC readers currently available on the system.
source§

fn connect_impl(&mut self, reader: &str) -> Result<()>

Actually connect to the given reader using the native PC/SC library. This trait already provides the higher level connect, which handles selecting the right reader, and performing setup interactions with the device after connecting. This function simply wraps the real interaction with the underlying hardware.
source§

fn disconnect(&mut self)

Disconnect from the current reader, if any.
source§

fn send_data_impl(&self, apdu: &Apdu) -> Result<(StatusWord, Vec<u8>)>

Send data to the underlying hardware. The given byte slice must be formatted as a smart card APDU (https://en.wikipedia.org/wiki/Smart_card_application_protocol_data_unit). This function should return a status word, as well as any bytes returned by the hardware.
source§

fn begin_transaction(&self) -> Result<()>

Start a new PC/SC transaction with the underlying hardware.
source§

fn end_transaction(&self) -> Result<()>

End a previously started PC/SC transaction with the underlying hardware.
source§

fn connect(&mut self, reader: Option<&str>) -> Result<()>

Connect to the given reader (or the default reader, if none was specified). This must be called before e.g. data is sent or transactions are started.
source§

fn send_data(&self, templ: &[u8], data: &[u8]) -> Result<(StatusWord, Vec<u8>)>

A provided, higher-level interface for sending data to the underlying hardware.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more