How to receive keys from a keyserver when you don't have a key ID, using command-line.

David Shaw dshaw at jabberwocky.com
Fri Mar 17 22:18:28 CET 2006


On Fri, Mar 17, 2006 at 11:16:25AM -0800, John Schofield wrote:
> I'm setting up an experimental private keyserver network and trying  
> to write scripts to interact with it from the command-line. (OS:  
> Ubuntu Linux 5.10)
> 
> Let's say that my script is asked to encrypt to a unique user ID.  
> (All user IDs will be unique; this is a closed system and I can  
> control that.)
> 
> If the local machine has the key in its keyring, it can just enter  
> the following:
> gpg -se -r $RECIPIENTID -o $TARGETFILE -u $SIGNINGID $SOURCEFILE
> 
> However, if the $RECIPIENTID does not exist in the local keyring, gpg  
> fails. Fine. I should be able to request the key from the keyserver.  
> But in order to request the key from the keyserver, I need the Key ID  
> (ie 0xEE3A668A) rather than a unique identifier (unique.id. 
> 12345678 at testsystems.dakim.com).

Upgrade to 1.4.3 when it comes out (or use the 1.4.3rc2, the latest
release candidate).  This version has a feature called
auto-key-locate.  Put:

  auto-key-locate hkp://your.keyserver

in your gpg.conf.  Then, when encrypting, if $RECIPIENTID is in the
form of an email address (in your example it is), and that key is not
on the local keyring, GPG will automatically fetch it from the
keyserver.

David



More information about the Gnupg-users mailing list