The answer from @vhallac is now out of date (I'm trying to verify an emacs-24.4 download). If you don't want to download and import the entire GNU keyring (as @JSON discussed), here's a way to get this done. In this answer I'll show what works today but also how to figure out what will work a year from now.
First download emacs and its .sig
file. I have:
$ ls | grep emacs
emacs-24.4.tar.xz
emacs-24.4.tar.xz.sig
Assuming you already have gpg installed, try to verify it:
$ gpg --verify emacs-24.4.tar.xz.sig
gpg: Signature made Mon 20 Oct 2014 02:58:21 PM EDT using RSA key ID A0B0F199
gpg: Can't check signature: public key not found
In this attempt, it fails (you'll see a successful attempt at the end of this post). I don't have the public key. The output tells you which public key you need to obtain: A0B0F199
. (This is the thing that will most likely change in the future.)
So I then try to download it with the default command:
$ gpg --recv-keys A0B0F199
gpg: requesting key A0B0F199 from hkp server keys.gnupg.net
(...hangs here...)
It just hangs. That's because I have ufw
(my Linux firewall software) blocking most ports. You can tell gpg to use port 80, like so:
$ gpg --keyserver hkp://keys.gnupg.net:80 --recv-keys A0B0F199
gpg: requesting key A0B0F199 from hkp server keys.gnupg.net
gpgkeys: key A0B0F199 not found on keyserver
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
That got through the firewall, but fails because, for some reason, the Emacs/FSF keys are no longer being stored on the gnupg server. So I tried the other keyserver I know about and have some level of trust of:
$ gpg --keyserver hkp://pool.sks-keyservers.net:80 --recv-keys A0B0F199
gpg: requesting key A0B0F199 from hkp server pool.sks-keyservers.net
gpg: key A0B0F199: public key "Glenn Morris <[email protected]>" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
OK, it worked. Now check it:
$ gpg --list-keys
...
pub 2048R/A0B0F199 2012-12-23 [expires: 2015-12-23]
uid Glenn Morris <[email protected]>
sub 2048R/951C59EC 2012-12-23 [expires: 2015-12-23]
Yep, got it.
Now I can verify the downloaded emacs tarball:
$ gpg --verify emacs-24.4.tar.xz.sig
gpg: Signature made Mon 20 Oct 2014 02:58:21 PM EDT using RSA key ID A0B0F199
gpg: Good signature from "Glenn Morris <[email protected]>"
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: B294 26DE FB07 724C 3C35 E5D3 6592 E9A3 A0B0 F199
The signature is "good", but not trusted. See the other answers for how to trust that key.
BE216115
being the key)? Also simply trusting any added key does not seem to be a good practice. – Turnheim