Skip to main content

Module smartcard

Module smartcard 

Source
Expand description

Security keys through the system’s smart card service, PC/SC: pcscd (pcsc-lite) on Linux, the Smart Card service on Windows, CryptoTokenKit on macOS. The OpenPGP card protocol is openpgp-card 0.7’s, its transport card-backend-pcsc 0.5’s (both Heiko Schaefer’s, MIT OR Apache-2.0).

  • Shared, one operation at a time. Each reader is connected in shared mode, so that GnuPG may share the key when its scdaemon.conf says pcsc-shared; one transaction serves one operation, and the key is then disconnected, which resets it (pcsc’s own Drop disposes with ResetCard): its PIN, once given, does not stay given for another program.
  • Readers one by one. card-backend-pcsc skips, silently, a reader it cannot connect to: a key that GnuPG holds for itself would read as no key. Sioul connects each reader itself, and counts a sharing violation as a busy key, which the window says, with “Let GnuPG release it”.
  • Status words in words (CardError): 63Cx a wrong PIN with x tries left, 6983 a locked PIN, 6600 (the specification’s “security-related issues”, kept for the touch button) a touch missed, and so is 6982 just after the PIN was taken, when the key asks for a touch; a card taken out while it worked, the key removed.
  • Nothing is logged here. openpgp-card writes whole APDUs at the “trace” level, a VERIFY’s PIN included, and the card’s answers (session keys): Sioul installs no logger, and caps the level at “info” as each program starts (super::cap_logging).

Structs§

PcscCard 🔒
One OpenPGP card, open in one transaction.
PcscReaders
The system’s readers, through PC/SC.

Functions§

algorithm_name 🔒
“Ed25519”, “Curve25519”, “RSA 4096”, “NIST P-256”: as GnuPG and YubiKey Manager name them.
card_error 🔒
What the card or the reader said, as Sioul says it. touch_after_pin: the key took the PIN in this transaction and asks for a touch, so that its refusal now is the touch’s.
establish 🔒
The smart card service, reached; else why not.
readers_of 🔒
The readers the service knows: none is no error.
touch_of 🔒
What a key’s user interaction flag says of its touch (DO D6 for signing, D7 for decrypting, D8 for authenticating: its first byte, the touch policy). A card without the flag asks for none; a flag that does not read is a touch maybe asked: said “If your key asks for a touch…”, a wrong guess costing nothing.