Expand description
Your OpenPGP keys on a security key: an OpenPGP card, such as a YubiKey or a Nitrokey (OpenPGP card specification 3.4).
The private keys never leave the security key. Sioul hands it what must be signed (a digest) or opened (a session key, wrapped), after its PIN, and gets the result back; the key may also wait for a touch. Everything public Sioul keeps itself, the certificate above all: a security key holds no certificate, only its keys’ fingerprints and public parts.
Readersis how Sioul reaches security keys: the system’s smart card service (PC/SC) on a computer, a software stand-in (SoftReaders) in tests. A key is opened for one operation, then closed, which resets it: no other program finds it unlocked afterwards.CardSignerandCardDecryptorare Sequoia’s ownSignerandDecryptorfor a key on a security key. Each opens the security key when Sequoia asks for a signature or a session key, not before. The glue follows Heiko Schaefer’sopenpgp-card-sequoia, as Sequoia’s key store carries it (sequoia-keystore-openpgp-card0.2.2, itsdecrypt_ciphertextandsign, MIT OR Apache-2.0).checktells whether a certificate belongs to a security key: its fingerprints, its public keys, what each key may do, until when.KnownCardis what Sioul remembers of a security key, inpgp/cards.toml: no secret.PinMemoryholds a PIN in memory only, kept encrypted there by Sequoia, for fifteen minutes without use.CardErrorsays each failure in words, with what to do.
Sioul only uses a security key: it never asks for its Admin PIN, never changes or unblocks a PIN, never loads or makes keys on it.
Structs§
- Card
Access - What it takes to use a security key now: where to find it, its PIN, and what to say when it waits for a touch.
- Card
Decryptor - Opens session keys with the key of a security key, as Sequoia’s
Decryptor: the key is opened when Sequoia asks. - Card
Info - What a security key says without its PIN.
- Card
Signer - Signs with the key of a security key, as Sequoia’s
Signer: the key is opened when Sequoia asks for the signature, and each signature is checked with the certificate’s key before it is given back. - Cards
File 🔒 - Cert
Check - A certificate checked against a security key: it belongs to it.
- Certificate
- A certificate, as the crates that do not use Sequoia themselves name it. A collection of components and their associated signatures.
- Held 🔒
- Known
Card - A security key Sioul knows, in
pgp/cards.toml: which keys it holds, the certificate they belong to and where it came from. No secret. - NoReaders
- A build without a way to security keys: each use says so.
- Part
- One key of a certificate: what it is for, its fingerprint, until when (Unix seconds; none when it does not expire).
- Password
- A PIN, or a passphrase: kept encrypted in memory by Sequoia, wiped when dropped. Holds a password.
- PinMemory
- The PIN of one security key, held in memory only, encrypted there by
Sequoia (
Password), forPIN_QUIETafter its last use. Never on disk, in the keyring or in a log. Forgotten when Sioul closes, when the key goes away (on a computer), or on “Forget the PIN now”. - Protected
- Bytes kept in protected memory, wiped when dropped: what a card opened. Protected memory.
- Slot
Info - One key of the security key, as it describes it.
- Soft
Card - A security key made of software keys, behind the same traits as a real one,
for tests: Sioul itself never makes one. It counts its PIN tries, forgets a
verified PIN when closed, asks the PIN again after each signature when told
to, and can fail as a real key does (
SoftCard::fault). - Soft
Readers - Readers holding
SoftCards, for tests: none, some, held by another program, or no smart card service at all. - Visited
- What a visit met.
Enums§
- Card
Error - Why a security key could not be used, each with its sentence.
- Card
Public - A key’s public part as the card gives it.
- Hash
Algorithm - A hash, as a card’s RSA signature names it. The OpenPGP hash algorithms as defined in Section 9.5 of RFC 9580.
- Mismatch
- Why a certificate is not the one of a security key.
- PinMode
- Which check of the PIN an operation needs. A card keeps two from the one PIN: for signing (PW1 in mode 81), and for the rest (mode 82).
- Purpose
- What Sioul was doing with the key, for the words of a failure.
- Remedy
- What the window offers after a failure.
- Role
- What a key of a certificate is for, as said to you.
- ToDecipher
- What the card opens (specification §7.2.11): RSA’s ciphertext, giving the session key; or, for ECDH, the sender’s ephemeral point, giving the shared secret, from which Sioul unwraps the session key.
- ToSign
- What the card is given to sign: a digest as it is (EdDSA, ECDSA), or, for
RSA, a digest and its hash, which
openpgp-cardbuilds into a DigestInfo (signature_for_hash, specification §7.2.10.2) before the card pads and signs it. - Touch
- Whether a key on the security key waits for a touch before it works: its “user interaction flag”, the touch policy of a YubiKey.
- Visit
- Whether
Readers::visitgoes on to the next key.
Constants§
- PIN_
QUIET - How long a PIN stays in memory after its last use (the owner’s choice: 15 minutes).
Traits§
- Card
- A security key, open for one operation: what it says, its PIN, and its two
private operations. The opening and the closing are the
Readers’. - Readers
- Where Sioul finds security keys: the system’s smart card service on a computer, a phone’s NFC or USB, a software stand-in in tests.
Functions§
- adopt
- Makes the security key
cardyours: its certificate kept with your keys (public parts only), and the key incards.toml, signing foraddresses;sourcesays where the certificate came from. Gives what is kept. - algorithm_
name - “Ed25519”, “Curve25519”, “RSA 4096”, “NIST P-256”: a key’s algorithm, as GnuPG and YubiKey Manager name it.
- card_
public 🔒 - The card’s form of a public key (its point without OpenPGP’s 0x40).
- cards
- What every security key present says.
- cards_
path - Where the known security keys are listed.
- certificate_
in - The certificate of the security key
cardamongbytes(armored or binary, one certificate or several), with what it is; else why none is. - change_
known - Changes the list of known security keys: read, changed, written, one writer at a time.
- change_
known_ 🔒at - check
- Whether
certis the certificate of the security keycard: each key on the card is in it, alive or expired but not revoked, allowed to do what its slot does, and its public part is the card’s own. - expired_
parts - Each part that expired by
now, said exactly: which, since when, and what it stops (“Its encryption subkey (B81A…BF8C) expired on 8 April 2025: nobody can encrypt to you with it.”). - expiry_
line - What the certificate’s expiry says now: expired (and how to renew), soon (within a month), or valid until a date; nothing when it does not expire.
- expiry_
of - When a certificate stops serving a security key: the earliest expiry of
its primary key and of its keys named by
fingerprints(Unix seconds); None when none of them expires, or the certificate is not valid at all. - expiry_
words - What a certificate says of its expiry, part by part: each part expired,
exactly (“Its encryption subkey (B81A…BF8C) expired on 8 April 2025:
nobody can encrypt to you with it.”), and, when its subkeys alone expired,
that Renew renews them; else until when it is valid, or that it expires
soon (
expires, the earliest of the keys that matter). What it says, whether warmly, and whether a part expired. - forget
- Stops using the security key
ident: it leavescards.toml, and its certificate leaves your keys forpgp/removed(never deleted). - full_
date - “3 March 2026”, “3 mars 2026”.
- hint_
for_ 🔒os_ release - The hint for a Linux system, by its
/etc/os-release(ID, then ID_LIKE). - known_
cards - The security keys Sioul knows.
- label
- The name of a security key by its maker, then its serial number as printed on it: “YubiKey 12 345 678”, “Nitrokey 000F 1A2B”.
- no_
service_ 🔒hint - How to start the smart card service, for the system Sioul runs on.
- parts
- The keys of
certthat are not revoked, the primary key first, each with what it is for and until when: what is said of each, never “the key” for all of them when one part alone expired. - parts_
in - The parts of the first certificate among
bytes(gpg --export): none when there is none. - parts_
until - Every part and until when, in a line: “primary key until 7 October 2028, encryption subkey until 7 October 2028”; “without end” for one that does not expire.
- read_
known 🔒 - same_
public 🔒 - Whether a certificate’s key is the card’s: the same public part.
- say 🔒
- serial_
text - A serial number as printed on the key. Yubico writes its serials in decimal digits inside the card’s hexadecimal ones (“12345678” reads 0x12345678), so they are shown in groups of three, as a number; others stay hexadecimal.
- short_
fingerprint - “B81A…BF8C”: a fingerprint as it is told apart at a glance.
- subkeys_
of - The subkeys of a certificate that are not revoked, by fingerprint: what “Renew for two years” names one by one.
- with_
card - Opens the key
identforwork, given what it says; Absent when it is not there, Busy when another program holds a key Sioul could not open.
Type Aliases§
- Public
Key - A public key as Sequoia holds it, whatever its role in its certificate.