Minor additions to documentation

This commit is contained in:
Heiko Schaefer 2022-05-13 19:14:41 +02:00
parent f72c9687d9
commit f83e26f213
No known key found for this signature in database
GPG key ID: 4A849A1904CCBD7D
2 changed files with 27 additions and 9 deletions

View file

@ -309,7 +309,8 @@ impl Display for UIF {
} }
} }
/// User interaction setting. /// User interaction setting: is a 'touch' needed to perform an operation on the card?
/// This setting is used in 4.4.3.6 User Interaction Flag (UIF)
/// ///
/// See spec pg 24 and <https://github.com/Yubico/yubikey-manager/blob/main/ykman/openpgp.py> /// See spec pg 24 and <https://github.com/Yubico/yubikey-manager/blob/main/ykman/openpgp.py>
#[non_exhaustive] #[non_exhaustive]
@ -403,6 +404,7 @@ impl Display for Features {
} }
} }
/// 4.4.3.8 Key Information
pub struct KeyInformation(Vec<u8>); pub struct KeyInformation(Vec<u8>);
impl From<Vec<u8>> for KeyInformation { impl From<Vec<u8>> for KeyInformation {
@ -488,6 +490,8 @@ impl Display for KeyInformation {
} }
} }
/// KeyStatus is contained in `KeyInformation`. It encodes if key material on a card was imported
/// or generated on the card.
#[non_exhaustive] #[non_exhaustive]
pub enum KeyStatus { pub enum KeyStatus {
NotPresent, NotPresent,
@ -759,6 +763,7 @@ impl Display for CardholderRelatedData {
} }
/// 4.4.3.5 Sex /// 4.4.3.5 Sex
///
/// Encoded in accordance with <https://en.wikipedia.org/wiki/ISO/IEC_5218> /// Encoded in accordance with <https://en.wikipedia.org/wiki/ISO/IEC_5218>
#[derive(Debug, PartialEq, Clone, Copy)] #[derive(Debug, PartialEq, Clone, Copy)]
pub enum Sex { pub enum Sex {
@ -805,6 +810,9 @@ impl From<u8> for Sex {
} }
} }
/// Individual language for Language Preferences (4.4.3.4), accessible via `CardholderRelatedData`.
///
/// Encoded according to <https://en.wikipedia.org/wiki/ISO_639-1>
#[derive(Debug, PartialEq, Clone, Copy)] #[derive(Debug, PartialEq, Clone, Copy)]
pub enum Lang { pub enum Lang {
Value([u8; 2]), Value([u8; 2]),

View file

@ -13,17 +13,18 @@
//! [OpenPGP implementation](https://www.openpgp.org/software/developer/). //! [OpenPGP implementation](https://www.openpgp.org/software/developer/).
//! //!
//! This library can't directly access cards by itself. Instead, users //! This library can't directly access cards by itself. Instead, users
//! need to supply an implementation of the [`CardBackend`] //! need to supply a backend that implements the [`CardBackend`]
//! / [`CardTransaction`] traits, to access cards. //! / [`CardTransaction`] traits. The companion crate
//!
//! The companion crate
//! [openpgp-card-pcsc](https://crates.io/crates/openpgp-card-pcsc) //! [openpgp-card-pcsc](https://crates.io/crates/openpgp-card-pcsc)
//! offers a backend that uses [pcsclite](https://pcsclite.apdu.fr/) to //! offers a backend that uses [PC/SC](https://en.wikipedia.org/wiki/PC/SC) to
//! communicate with smartcards. //! communicate with Smart Cards.
//! //!
//! The [openpgp-card-sequoia](https://crates.io/crates/openpgp-card-sequoia) //! The [openpgp-card-sequoia](https://crates.io/crates/openpgp-card-sequoia)
//! crate offers a higher level wrapper based on the //! crate offers a higher level wrapper based on the [Sequoia PGP](https://sequoia-pgp.org/)
//! [Sequoia PGP](https://sequoia-pgp.org/) implementation. //! implementation.
//!
//! See the [architecture diagram](https://gitlab.com/hkos/openpgp-card#architecture) for
//! a visualization.
extern crate core; extern crate core;
@ -498,10 +499,19 @@ impl From<ShortTag> for Vec<u8> {
} }
} }
/// Specify a PIN to *verify* (distinguishes between `Sign`, `User` and `Admin`).
///
/// (Note that for PIN *management*, in particular changing a PIN, "signing and user" are
/// not distinguished. They always share the same PIN value `PW1`)
#[derive(Debug, Clone, Copy, Eq, PartialEq)] #[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub enum PinType { pub enum PinType {
/// Verify PW1 in mode P2=81 (for the PSO:CDS operation)
Sign, Sign,
/// Verify PW1 in mode P2=82 (for all other User operations)
User, User,
/// Verify PW3 (for Admin operations)
Admin, Admin,
} }