Aw: Re: Encrypt directly to keyfile

Matthias Fischer mmfische at
Fri Jul 18 09:54:25 CEST 2014

Hauke schrieb:

> Why should a feature be added that can so easily be emulated by a simple
> script?

To spare people the work of writing the same „simple script“ over and over again.

> gpgdir="/tmp/keyring.$$"
> test -d "$gpgdir" && rm -r "$gpgdir"
> gpg --homedir "$gpgdir" --import KEYFILE
> KEY_ID="$(gpg --homedir "$gpgdir" --with-colons --list-keys |
> awk -F: '$1 == "pub" {print $5;}')"
> gpg --homedir "$gpgdir" --recipient "$KEY_ID" --encrypt FILE
> rm -r "$gpgdir"

Does this really work?
I mean especially the part: --recipient "$KEY_ID"
in case the string contains more than one ID, my version of GnuPG only encrypts to the first one mentioned.
I have to specify --recipient KEY1 --recipient KEY2 and so on.


More information about the Gnupg-users mailing list