Encrypt directly to keyfile

Matthias Fischer mmfische at web.de
Sun Jul 6 23:18:20 CEST 2014

Hi folks,
I already asked the question here about half a year ago, but IIRC didn't get any reaction:

Imagine you have a file containing one or more PGP-Public-Keys, and you want to encrypt something for this key, without adding the key to your public keyring. Is there some commandline option to easily achieve this?
I would expect something like:
$ gpg --recipient-file <KEYFILE> -e
instead of:
$ gpg --recipient <KEY-ID> -e

I can achieve something similar, by using:
$ gpg --no-default-keyring --keyring /tmp/keyring.once --import <KEYFILE>
$ gpg --no-default-keyring --keyring /tmp/keyring.once --trust-model always --recipient <KEY-ID> -e

But this requires an additional temporary file (which needs to be deleted), and I still have to look for the Key-IDs in the file, to give them as parameters.

If there isn't an option for this, I think it would be a neat feature to implement.

One might ask what this is good for:
I'm thinking mostly about automated systems. Imagine a webforum, mailinglist or something similar. The interface could provide the user with an input-area to paste a public key(s) into, and then every automated mail (like forgotten-password, notifications or reminders) could be encrypted directly to those keys.


More information about the Gnupg-users mailing list