Currently I can use
$ gpg --expert --card-status
to interact with smartcards that run the OpenPGP applet. Through trial-and-error, it seems that only the first card reader will interact with
gpg. Using options that pass to
scdaemon seem to be deprecated:
$ gpg --reader-port 1 --card-status gpg: WARNING: "--reader-port" is an obsolete option - it has no effect except on scdaemon
Is there a way to interact with an OpenPGP smartcard that is not connected to the first card reader?
Edit: After some more research, I found a blog post from the author of the libccid library https://ludovicrousseau.blogspot.com/2019/06/gnupg-and-pcsc-conflicts.html that mentions:
Tell GnuPG to use PC/SC
Another solution is to make GnuPG and pcscd collaborate to work together. Luckily it is possible to do that using the scdaemon option
From the documentation:
--disable-ccid Disable the integrated support for CCID compliant readers. This allows falling back to one of the other drivers even if the internal CCID driver can handle the reader. Note, that CCID support is only available if libusb was available at build time.
With this option scdaemon will use PC/SC to talk to the smart card and the conflict is solved.
It is possible to tell scdaemon to always use this option by editing the scdaemon configuration file. By default it is
~/.gnupg/scdaemon.confand it should contain the line:
Edit 2: With these configuration adjustments:
pcsc-driver /usr/lib/x86_64-linux-gnu/libpcsclite.so.1 disable-ccid reader-port <reader-string>
I'm able to restart the agent with
systemctl --user restart gpg-agent.service in order to use the different reader. This works!
Is there any way to pass the reader option to
gpg or the
scdaemon instead of editing a on-disk file & restarting? If a shell script is needed, is it possible to send a signal instead of file/restart workflow?