Skip to main content
edited tags
Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 264
Source Link
Xaldew
  • 273
  • 3
  • 9

GPG: Generating signatures for multiple files

Is there any way to sign multiple files with GPG when the signing key is stored on a keycard? (Or more specifically in my case, a Yubikey).

Currently, I have a script where I loop over a number of files that I want to sign, e.g.:

for pkg in html/packages/*.tar;
do
    gpg2 --detach-sign --armor -o $pkg.sig $pkg
done

This works, but as there is a pin-code on my keycard I'm being prompted to enter my pin for each file which gets very tiresome after just a few files.

Is there any way to sign all files at once? Alternatively, is there some workaround for the signing process such that the pin-code can be cached between invocations?