Expand description

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

This library aims to offer

This library can’t directly access cards by itself. Instead, users need to supply a backend that implements the CardBackend / CardTransaction traits. The companion crate openpgp-card-pcsc offers a backend that uses PC/SC to communicate with Smart Cards.

The openpgp-card-sequoia crate offers a higher level wrapper based on the Sequoia PGP implementation.

See the architecture diagram for a visualization.


Data structures that define OpenPGP algorithms.

OpenPGP card data objects (DO)

Data structures for cryptographic material: Private key data, public key data, cryptograms for decryption, hash data for signing.


Information about the capabilities of a card.

A KeySet binds together a triple of information about each Key on a card

An OpenPGP card access object, backed by a CardBackend implementation.

Low-level access to OpenPGP card functionality.


Enum wrapper for the different error types of this crate

Identify a Key slot on an OpenPGP card

Specify a PIN to verify (distinguishes between Sign, User and Admin).

Errors on the smartcard/reader layer

OpenPGP card “Status Bytes” (ok statuses and errors)


The CardBackend trait defines a connection with an OpenPGP card via a backend implementation (e.g. via the pcsc backend in the crate openpgp-card-pcsc), A CardBackend is only used to get access to a CardTransaction object.

The CardTransaction trait defines communication with an OpenPGP card via a backend implementation (e.g. the pcsc backend in the crate openpgp-card-pcsc), after opening a transaction from a CardBackend.