Usecase: Use a dedicated keyring in a program / script using gpgme.
I think this is a very legitimate usecase and also a possible solution for
issue2819 (you could import / list on a temporary keyring)
I've also needed this when writing a script for WKD generation. We have a
"employee keyring" in our company that is updated when someone joins or leaves
the company. That keyring (the whole directory containing it) is read only for
users so changing the homedir is not really an option.
Workarounds for this are to use wrapper scripts that add --no-default-keyring
--no-options and --keyring. Ugly!
Example workaround from generate-openpgpkey-hu:
if not os.path.exists(keyring):
raise KeyringError( "keyring '%s' not found" % keyring)
tmpdir = tempfile.mkdtemp("-hugen")
filename = os.path.join(tmpdir, "my-gpg")
gpgfile = open(filename, 'w')
for engine in pyme.core.get_engine_info():
if engine.protocol == pyme.constants.protocol.OpenPGP: oldgpg = engine.file_name
gpgfile.write('#!/bin/sh\nexec "%s" --no-default-keyring '
'--no-options --keyring "%s" "$@"\n' % (oldgpg, keyring))
os.chmod(filename, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)