Douglas Crawford

Douglas Crawford

March 13, 2015

A while ago we discussed cryptographic hashes (such as MD5 and SH1 checksums), and how they help ensure that a file you download is the same file that its creator intended you to download by creating a unique ‘fingerprint’ of the file that can be checked against the original.

The ability to verify the integrity of just about any file is important, but when we download privacy and security software from the internet it is absolutely critical. After all, what is the point of trustintordocsg your privacy and security to a program that may contain a virus or be backdoored, especially when you consider that such software and its users are without any doubt high priority targets for the NSA and its ilk?

Even when you download software directly from a vendor or developers’ website, you might become victim to a Man-in-the-Middle (MitM) attack, or the website itself might be compromised in various ways.

Using cryptographic hashes is an attempt to solve this problem, but unfortunately the technique has major weakness – for example a developer’s website may be hacked to display the hash of a compromised file rather than the original, or mathematical vulnerabilities can make them insecure. Hashes are therefore useful in verifying that a file has not been corrupted, but are only of limited use in ensuring that the file you download is same file its developers intend you to download.

To provide greater assurances of this, developers can sign their files with digital signatures, which employ a form of asymmetric cryptography (public keys and private keys) to verify that a file is exactly what it claims to be.

Digital_Signature_diagram A diagram showing how a digital signature is applied and then verified

Digital signatures work very much like key pairs in PGP (which is no surprise as they are basically the same technology, and as we shall see, verifying digital signatures requires using a PGP-compatible client.)

Unfortunately, this also means that like PGP, using digital signatures is a real pain in the butt…

How to verify a digital signature using Kleopatra GUI

To verify a file’s digital signature you must use a PGP client (or more accurately GnuPG – its open source clone). Versions of GnuPG are available for Windows (Gpg4win), Mac OSX, and Linux (usually pre-installed).

In this tutorial we will verify the Digital signature of Pidgin + OTR using Gpg4win, but the process is very similar for other versions of GnuPG.

We have a two-part article on using Gpg4win, and we strongly recommend reading at least Part 1 of it to familiarise yourself with key concepts that will be used below.

The Gpg4win download is itself digitally signed with a key that has been verified by a recognized certificate authority (CA), and which can be independently checked for verification using a trusted older copy of GnuPG (an SHA1 hash is also available). You should never trust a copy of Gpg4win that you have not verified.

Once GnuPG is installed, we need three things to verify a digital signature:

These files should all (hopefully) be provided by the developer whose digitally signed files you wish to verify. Public key/PGP Certificates are often stored on a keyserver, but the devs should provide instructions for accessing them.


Kleopatra is a key management program bundled with Gpg4win.

1. You will need a personal private key to certify the PGP certificate. If you have created one before (for example using GPA), then you can import it (File -> Import Certificates…), or you can create a new key pair (File -> New Certificate…).

 New key 1

Wizards will guide you through the rest of this process

2. Import the public key/PGP certificate into Kleopatra – using either ‘Import Certificates’, or right-clicking on the file and selecting ‘Import keys’.

Import key 1

3. Certify the PGP certificate using your private key – this tells GnuPG that you trust the person who signed the certificate.

a) In Kleopatra right-click on the key and select ‘Certify Certificate’.

certify CA

b) Select the certificate, and confirm that you have verified its fingerprint (hopefully this will be published on the developer’s website, but see also below for further discussion on this point).

certify 2

c) Unless you are very sure about the authenticity of the certificate then you should Certify only for yourself (certificates work on the principle of a web of trust – the more people who trust them, the more sure you can be they are genuine).

certify 3

d) Enter your private key passphrase to finish verifying the certificate.

certify 4

4. Now that you have certified the Certificate used to make the signature for the file you have downloaded (whew!), you can use it to verify the signature.

a) In Kleopatra go to File -> Decrypt/Verify files and browse to the signature file, or right-click on it and go to MoreGpgEX options -> Verify.

verify 1

b) Ensure ‘Input File’ is the signature file, and that the ‘Signed data’ field contains the program or file you wish to verify, then hit ‘Decrypt/Verify’.

verify 2

c) All being well, Kleopatra will declare the signature valid. Yay!

verify 3

How can I trust a Certificate?

The simplest way to verify that a PGP Certificate is valid is to check website of the person who is supposed to have signed the certificate… with a bit of luck it will publish the fingerprint of the certificate.

However, although easy, this does not guarantee the authenticity of the signature, as the website may have been hacked or forced by a government to display a fake fingerprint (the same problem that plagues cryptographic hashes).

This is where the web of trust comes in, where users vouch for a certificate. In practice, this is an arcane process that is both too complex and too obscure for most users, so the best that most of us can hope for is that the certificate has been vouched for by a recognised Certificate Authority, or is signed by known developers who publish their signing keys (as the Tor developers do, for example).

Pidgin + OTR is in some ways a bad example of how digital signing should work, because the OTR webpage comes with almost no instructions on how to use its published keys, and its PGP Certificate was not only very difficult to locate, but other than being available from there is no easy way to verify its authenticity (the fact that uses a 1024-bit RSA key is also poor show in this age when the NSA can probably crack such weak encryption).

It is, however, a good example of why the whole notion of digital signatures is such a mess! An interesting discussion on how you can attempt to verify the OTR Certificate is available here.)


As you can see, verifying a digital signature really is a pain, so it is little wonder that even those who understand the jargon heavy arcane process rarely bother. The issue is made even worse by many devs failing to explain how to verify their files, and/or issuing sloppy PGP Certificates that are very hard to verify are genuine (OTR-team, we are looking at you!)

The fact that digital signatures remain the only meaningful way to guarantee that files you download are the ones you intended to download (or that their devs intended you to download), does not bode well for internet security.

However, until someone invents a better, more user-friendly system, our best hope is to encourage devs to provide clear instructions on how to use their digital signatures, and to publish meaningful guarantees as to the authenticity of their PGP Certificates… (sigh)

Douglas Crawford
September 21st, 2016

I am a freelance writer, technology enthusiast, and lover of life who enjoys spinning words and sharing knowledge for a living. You can now follow me on Twitter - @douglasjcrawf.

2 responses to “Digital signatures – why and how you should use them

  1. v13 says:

    > |Conclusion|
    i use cli, it is easier & faster and i do not enter in the chain of trust as soon as something difficult, obscure or unclear happens (revoking a certificate is a ‘+’).

    1. Douglas Crawford says:

      Hi v13,

      This guide is intended as a basic introduction to digital signatures, which is why I taken the GUI route. It is, of course , possible to use the command line instead. As you say, this also make revoking certs easier etc. Thanks for your input on this, and look out for an expansion of this guide in the (hopefully) not too distant future.

Leave a Reply

Your email address will not be published. Required fields are marked *