OpenPGP

Struct OpenPGP 

Source
pub struct OpenPGP { /* 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 OpenPGP object, including in long-running programs. All operations must be performed on a Transaction (which must be short-lived).

Implementations§

Source§

impl OpenPGP

Source

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

Turn a CardBackend into a OpenPGP 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§

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> Same for T

Source§

type Output = T

Should always be Self
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.