Take the tour ×

How do you exchange keys with via key server?

Worked example would be great with send and find+retrieve.

I know gpg --send-keys is the command but how do you find the keyid (tried all output from ---list-keys). --keyserver keys.gpugp.net works with --send-keys but not with --search-keys (says bad uri). Which keys should I publish? What key server to publish to. Despite being a pretty simple program, the gnugp docs are terrible (broken links, missing info).

share|improve this question
add comment

2 Answers

up vote 0 down vote accepted

What Went Wrong

You're dealing with two problems:

  1. gpg --search-keys searches keyservers, not locally. Use gpg --list-keys instead.
  2. GnuPGs keyserver domain is keys.gnupg.net, not keys.gpugp.net (typo). Additionally, you have to prefix a protocol, hkp:// is supported by most keyservers.

Relevant Commands for Exchanging Keys

  • gpg --send-keys [keyid]: Send key id to a keyserver
  • gpg --recv-keys [keyid]: Fetch key id from a keyserver
  • gpg --search-keys [needle]: Search for keys on a keyserver that contain "needle", eg. in a UID
  • gpg --list-keys [needle]: List all local keys that contain "needle", eg. in a UID

To select another keyserver than the default one configured, use --keyserver [URI]. Make sure to use a complete and valid URI like hkp://pool.sks-keyservers.net, or hkp://keys.gnupg.net (which actually refers to the SKS keyserver pool ourdays).

share|improve this answer
Should I publish my pub, sub or both keys? –  Brian Low Sep 13 at 5:00
Publish all public keys. You want to use your subkeys for "daily work", so they need to be published. Signatures are bound to the primary key, so for validating that one is necessary, too. But you do not have to care about all that, GnuPG does for you, just use gpg --send-keys [primary] and it will also upload your (public) subkeys. –  Jens Erat Sep 13 at 7:58
add comment

Just for completion: it doesn't matter which key server you use. They do synchronise their keys.

I use pool.sks-keyservers.net which is a virtual load balancing key server.

share|improve this answer
add comment

Your Answer


