Conditional options directives

Kevin Kammer Lists.gnupg at mephisto.fastmail.net
Mon May 2 20:49:01 CEST 2011


I think this post falls under the heading of "Feature Request," unless someone already knows how to accomplish the following.

I think it would be useful if there was a way to format the GnuPG options file to conditionally apply options, depending on the key used (or potentially, depending upon the values of other variables, though key or user ID seem to be the most likely candidates).

Let us suppose that we have more than one private key on our keychain. For this example, let's say we use one key to sign our personal email, and a different one to sign software packages we host on a company server. There may be settings in our gpg.conf file which should be different depending on the key we are using at the time. E.G. different URLs for retrieving keys, different comments, etc. This could be accomplished by saving different configuration files and specifying which one you want to use for any given operation with the --options flag, but wouldn't it be nice if the process could be automated? Not just nice, but much easier for other programs which interface with GnuPG, such as a mail plugin, for which there may be no convenient way to pass command line options.

So, what I am thinking of is semantically a little like a pre-processor directive...

#if (keyID == 123456)
      /* Use these options */
#elif (keyID == 789abc)
      /* Use some different options */
#else
      /* Fall back to a default set of options */
#endif

Obviously it wouldn't look like that in the gpg.conf file, but the model of conditional compilation gets the point accross (I hope).

Does anyone agree with me that this would be a good idea, or am I just crazy? Better yet, does anyone already implement some kind of conditional options parsing, using a technique which hasn't occured to me?

-- 
"Le hasard favorise l'esprit préparé."
                       --Louis Pasteur
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 719 bytes
Desc: not available
URL: </pipermail/attachments/20110502/88f0c6dc/attachment.pgp>


More information about the Gnupg-users mailing list