Crate openpgp_card

source ·
Expand description

Client library for OpenPGP card devices (such as Gnuk, Nitrokey, YubiKey, or Java smartcards running an OpenPGP card application).

This library aims to offer

The library exposes two modes of access to cards:

  • low-level, unmediated, access to card functionality (see crate::ocard), and
  • a more opinionated, typed wrapper API that performs some amount of caching Card.

Note that this library can’t directly access cards by itself. Instead, users need to supply a backend that implements the card_backend::CardBackend and card_backend::CardTransaction traits. For example card-backend-pcsc offers a backend implementation that uses PC/SC to communicate with Smart Cards.

See the architecture diagram for an overview of the ecosystem around this crate.


  • Low-level access to an OpenPGP card application
  • States of a card are modeled by the types Open, Transaction, User, Sign, Admin.


  • Representation of an OpenPGP card.
  • Optional PIN, used as a parameter to Card<Transaction>::into_*_card.


  • Enum wrapper for the error types of this crate