Card

Struct Card 

Source
pub struct Card<T, Ctx>
where T: HandlerInCtx<Ctx>, Ctx: Copy,
{ /* private fields */ }
Expand description

An adapter to communicate with the card through the delegate

Implementations§

Source§

impl<T, Ctx> Card<T, Ctx>
where T: HandlerInCtx<Ctx>, Ctx: Copy,

Source

pub fn new(delegate: Box<T>) -> Self

Initiates an adapter with the delegate.

Source

pub fn select_df(&self, ctx: Ctx, name: Vec<u8>) -> Result<(), Error>

Selects a DF with their name.

Source

pub fn select_ef(&self, ctx: Ctx, id: Vec<u8>) -> Result<(), Error>

Selects a EF with their name.

Source

pub fn read(&self, ctx: Ctx, len: Option<u16>) -> Result<Vec<u8>, Error>
where Ctx: Copy,

Reads binary from the selected file for len octets max.

Source

pub fn verify(&self, ctx: Ctx, pin: Vec<u8>) -> Result<(), Error>

Verifies the PIN.

Source

pub fn sign(&self, ctx: Ctx, digest: Vec<u8>) -> Result<Vec<u8>, Error>

Computes a signature using the selected key.

Source

pub fn verify_pin( &self, ctx: Ctx, ef: [u8; 2], pin: Vec<u8>, ) -> Result<(), Error>

Selects a EF then verifies the pin using the EF.

Source

pub fn pin_status(&self, ctx: Ctx, ef: [u8; 2]) -> Result<u8, Error>

Source

pub fn read_der_size(&self, ctx: Ctx) -> Result<u16, Error>

Extracts the size of current file by reading DER-encoded ASN.1 header.

Auto Trait Implementations§

§

impl<T, Ctx> Freeze for Card<T, Ctx>

§

impl<T, Ctx> RefUnwindSafe for Card<T, Ctx>

§

impl<T, Ctx> Send for Card<T, Ctx>
where Ctx: Send, T: Send,

§

impl<T, Ctx> Sync for Card<T, Ctx>
where Ctx: Sync, T: Sync,

§

impl<T, Ctx> Unpin for Card<T, Ctx>
where Ctx: Unpin,

§

impl<T, Ctx> UnwindSafe for Card<T, Ctx>
where Ctx: UnwindSafe, T: UnwindSafe,

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.

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>,

Source§

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>,

Source§

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.