Encrypt to a key without importing it to keyring

NIIBE Yutaka gniibe at fsij.org
Fri Nov 24 01:48:43 CET 2017

Seby <seby2kt14 at gmail.com> wrote:
> Basically use gnupg without a keyring or trustdb. And the pass the armored
> pgp public key with each command and operation.

AFAIK, such a usage is not supported by GnuPG.

Well, I would imagine some use cases when we want to avoid any
dependency to specific user's configuration, keyring, and trustdb, of
his own.

Approximation would be using ephemeral GNUPGHOME.

I mean, starting your GnuPG session (or script) with:

   $ export GNUPGHOME=$(mktemp -p /run/user/$(id -u) -d)
   $ chmod og-rwx $GNUPGHOME; echo $GNUPGHOME

and remove the $GNUPGHOME after its use.

This is very useful for testing GnuPG, for example. 

More information about the Gnupg-users mailing list