Choose which secret key to use when doing a gpg --encrypt --sign

Dustin Kirkland picture Dustin Kirkland · Mar 8, 2012 · Viewed 10.4k times · Source

I have multiple secret keys in my GPG keyring.

I'd like to do a gpg -e -s -a to encrypt, sign, and ascii armor the output. However, I also need to specify which secret key to use for the signature, by key id.

Answer

Dustin Kirkland picture Dustin Kirkland · Mar 8, 2012

I needed the --local-user option.

gpg -e -s -a --local-user 0xDEADBEEF -r 0x01234567