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
impl OpenPGP
Sourcepub fn new<B>(backend: B) -> Result<Self, Error>
pub fn new<B>(backend: B) -> Result<Self, Error>
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”.
Sourcepub fn into_card(self) -> Box<dyn CardBackend + Send + Sync>
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.
Sourcepub fn transaction(&mut self) -> Result<Transaction<'_>, Error>
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.