How to verify signatures for packages

What is a signature and why should I check it?

How do you know that the Tor program you have is really the
one we made? Many Tor users have very real adversaries who might
try to give them a fake version of Tor — and it doesn't matter
how secure and anonymous Tor is if you're not running the real Tor.

An attacker could try a variety of attacks to get you to download
a fake Tor. For example, he could trick you into thinking some other
website is a great place to download Tor. That's why you should
always download Tor from https://www.torproject.org/. The
https part means there's encryption and authentication between your
browser and the website, making it much harder for the attacker
to modify your download. But it's not perfect. Some places in the
world block the Tor website, making users try somewhere else. Large
companies sometimes force employees to use a modified browser,
so the company can listen in on all their browsing. We've even seen
attackers who have the ability to trick your browser into thinking
you're talking to the Tor website with https when you're not.

Some software sites list sha1
hashes alongside the software on their website, so users can
verify that they downloaded the file without any errors. These
"checksums" help you answer the question "Did I download this file
correctly from whoever sent it to me?" They do a good job at making
sure you didn't have any random errors in your download, but they
don't help you figure out whether you were downloading it from the
attacker. The better question to answer is: "Is this file that I
just downloaded the file that Tor intended me to get?"

Where do I get the signatures and the keys that made them?

Each file on our download
page is accompanied by a file with the same name as the
package and the extension ".asc". These .asc files are GPG
signatures. They allow you to verify the file you've downloaded
is exactly the one that we intended you to get. For example,
torbrowser-install-4.0.5_en-US.exe is accompanied by
torbrowser-install-4.0.5_en-US.exe.asc. For a list
of which developer signs which package, see our signing keys page.

Windows

Once it's installed, use GnuPG to import the key that signed your
package. Since GnuPG for Windows is a command-line tool, you will need
to use cmd.exe. Unless you edit your PATH environment variable,
you will need to tell Windows the full path to the GnuPG program. If
you installed GnuPG with the default values, the path should be
something like this: C:\Program Files\Gnu\GnuPg\gpg.exe.

The Tor Browser team signs the Tor Browsers. Import its key
(0x4E2C6E8793298290) by starting cmd.exe and typing:

Notice that there is a warning because you haven't assigned a trust
index to this person. This means that GnuPG verified that the key made
that signature, but it's up to you to decide if that key really belongs
to the developer. The best method is to meet the developer in person and
exchange key fingerprints.

Mac OS X and Linux

You need to have GnuPG installed before you can verify
signatures. If you are using Mac OS X, you can install it from http://www.gpgtools.org/. If you
are using Linux, then it's probably you already have GnuPG in your
system, as most Linux distributions come with it preinstalled.

The next step is to use GnuPG to import the key that signed
your package. The Tor Browser team signs the Tor Browsers. Import its
key (0x4E2C6E8793298290) by starting the terminal (under "Applications"
in Mac OS X) and typing:

Notice that there is a warning because you haven't assigned a trust
index to this person. This means that GnuPG verified that the key made
that signature, but it's up to you to decide if that key really belongs
to the developer. The best method is to meet the developer in person and
exchange key fingerprints.

If you're a Linux user and you're using the Debian Tor (not Tor
Browser) packages, you should read the instructions on importing these keys to apt.
If you're using the RPMs (for Tor, not Tor Browser), you can
manually verify the signatures on the RPM packages by

Build reproducibility is a security
property of Tor Browser 3.0 and later. Anyone can build
Tor Browser on their own machine and produce a binary that is
bit-for-bit identical to the binary we offer on the download page.
Fortunately, it is not necessary for everyone to build the Tor Browser
locally to get this security. Verifying and comparing the signed list
of hashes
will confirm that multiple people have built Tor Browsers
identical to the download.

The steps below walk through this process:

Download the Tor Browser package, the sha256sums.txt file, and the
sha256sums signature files. They can all be found in the same directory
under
https://www.torproject.org/dist/torbrowser/, for example in '3.6.1'
for TBB 3.6.1.

Retrieve the signers' GPG keys. This can be done from the command
line by entering something like

gpg --keyserver keys.mozilla.org --recv-keys 0x29846B3C683686CC

(This will bring you developer Mike Perry's public key. Other
developers' key IDs can be found on
this
page.)

Verify the sha256sums.txt file by executing this command:

gpg --verify <NAME OF THE SIGNATURE FILE>.asc sha256sums.txt

You should see a message like "Good signature from <DEVELOPER
NAME>". If you don't, there is a problem. Try these steps again.

Now you can take the sha256sum of the Tor Browser package. On
Windows you can use the
hashdeep utility and run

Starting with Tor Browser 4.5a4 we sign our MAR files which helps
securing our update process. The downside of this is the need for additional
instructions to verify that the MAR files we ship are indeed the ones we
produced with our Gitian setup.

Assuming the verification happens on a Linux computer one first needs the
mar-tools-linux*.zip out of the gitian-builder/inputs
directory to remove the embedded signature(s). The steps to get the unsigned
MAR file on a 64 bit Linux are