[][src]Struct yubirs::piv::apdu::Apdu

pub struct Apdu { /* fields omitted */ }

APDU stands for "smart card Application Protocol Data Unit". This union definition is used by upstream's library to alternate between treating APDU data in a structured or unstructured way.

Methods

impl Apdu[src]

pub fn from_bytes(bytes: &[u8]) -> Result<Self>[src]

pub fn from_pieces(
    cla: u8,
    ins: u8,
    p1: u8,
    p2: u8,
    lc: u8,
    data: &[u8]
) -> Result<Self>
[src]

pub fn new_aid() -> Result<Self>[src]

Construct a new Application ID APDU, which should be sent to the underlying hardware when we connect to it.

pub fn raw(&self) -> &[u8][src]

Return this APDU's raw data, including the various properties which are normally broken out (e.g., this function returns more bytes than data).

pub fn raw_minimal(&self) -> &[u8][src]

Returns the same data as raw, but it excludes the extra tailing 0 bytes (i.e., it only includes the APDU's properties along with lc bytes of arbitrary data).

pub fn cla(&self) -> u8[src]

Instruction class - indicates the type of command, e.g. interindustry or proprietary.

pub fn ins(&self) -> u8[src]

Instruction code - indicates the specific command, e.g. "write data".

pub fn p1(&self) -> u8[src]

First instruction parameter for the command, e.g. offset into file at which to write the data.

pub fn p2(&self) -> u8[src]

Second instruction parameter for the command, e.g. offset into file at which to write the data.

pub fn lc(&self) -> u8[src]

Encodes the number (N_c) of bytes of command data to follow. The official specification says that this field can be variable length, but upstream specifies it statically at 1 byte.

pub fn data(&self) -> &[u8][src]

The command data. The official specification says this can be up to 65535 bytes long, but upstream defines it as a static 255 bytes.

pub fn data_minimal(&self) -> &[u8][src]

Returns the same data as data, but it excludes the extra trailing 0 bytes (i.e., it only includes lc bytes or arbitrary data).

Trait Implementations

impl Clone for Apdu[src]

impl Copy for Apdu[src]

impl Debug for Apdu[src]

impl Eq for Apdu[src]

impl PartialEq<Apdu> for Apdu[src]

Auto Trait Implementations

impl RefUnwindSafe for Apdu

impl Send for Apdu

impl Sync for Apdu

impl Unpin for Apdu

impl UnwindSafe for Apdu

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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