Import Keys from Keyserver Using GPG in Debian – How to Guide

debiangpgpgp

AFAIK The basic concept about gpg/pgp is that for two people who want to create trust between them is both publish a public key and private key (the private key is kept with the user who creates it, doesn't share) with strength (1024 bits at one time, 4096 now and 8192 in future and so on and on).

Now the two of them need to publish their public keys to a keyserver (similar to a phone directory) and give a link to the keyserver where those keys are published.

Now if I go to a server say https://pgp.mit.edu/ and search for ashish I will need many ones

https://pgp.mit.edu/pks/lookup?op=get&search=ashish&op=index

Let's say the Ashish I want is this one DAD95197 (just an example) how would I import that public key ?

I did try

└─[$] gpg --keyserver pgp.mit.edu --recv-keys DAD95197

gpg: keyserver receive failed: No keyserver available

but as can be seen that didn't work.

Best Answer

gpg --keyserver pgp.mit.edu --recv-keys DAD95197

is supposed to import keys matching DAD95197 from the MIT keyserver. However the MIT keyserver often has availability issues so it’s safer to configure another keyserver.

I generally use the SKS pools; here are their results when looking for “ashish”. To import the key from there, run

gpg --keyserver pool.sks-keyservers.net --recv-keys FBF1FC87DAD95197

(never use the short key ids, they can easily be spoofed).

This answer explains how to configure your GnuPG installation to always use the SKS pools.

Related Question