Struct openpgp_card::Card

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

An OpenPGP card object (backed by a CardBackend implementation).

Most users will probably want to use the PcscCard backend from the card-backend-pcsc crate.

Users of this crate can keep a long lived Card object, including in long running programs. All operations must be performed on a Transaction (which must be short lived).

Implementations§

source§

impl Card

source

pub fn new<B>(backend: B) -> Result<Self, Error>
where B: Into<Box<dyn CardBackend + Send + Sync>>,

Turn a CardBackend into a Card object:

The OpenPGP application is SELECTed, and the card capabilities of the card are retrieved from the “Application Related Data”.

source

pub fn into_card(self) -> Box<dyn CardBackend + Send + Sync>

Get the internal CardBackend.

This is useful to perform operations on the card with a different crate, e.g. yubikey-management.

source

pub fn transaction(&mut self) -> Result<Transaction<'_>, Error>

Start a transaction on the underlying CardBackend. The resulting Transaction object allows performing commands on the card.

Note: Transactions on the Card cannot be long running. They may be reset by the smart card subsystem within seconds, when idle.

Auto Trait Implementations§

§

impl !RefUnwindSafe for Card

§

impl Send for Card

§

impl Sync for Card

§

impl Unpin for Card

§

impl !UnwindSafe for Card

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

§

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.