How to Verify PGP Signature of Downloaded Software on Linux - LinuxBabe (2024)

PGP (Pretty Good Privacy) is a public key cryptography software that can be used to encrypt and sign data communication. In this tutorial, we will look at how to verify the PGP signature of software downloaded from the Internet on Linux.

Linux users can securely install software from their distribution’s repositories. But there are times when you need to download and install software from a website. How can you be sure that the software you downloaded wasn’t tampered with?

Some software authors sign their software using a PGP program such as GPG (GNU Privacy Guard), which is a free software implementation of the OpenPGP standard. In that case, you can verify the integrity of software using GPG.

The process is relatively simple:

  1. You download the public key (.asc file) of the software author.
  2. Check the public key’s fingerprint to ensure that it’s the correct key.
  3. Import the correct public key to your GPG public keyring.
  4. Download the PGP signature file (.sig) of the software.
  5. Use public key to verify PGP signature. If the signature is correct, then the software wasn’t tampered with.

We will use VeraCrypt as an example to show you how to verify PGP signature of downloaded software.

Example: Verify PGP Signature of VeraCrypt

Although VeraCrypt is open source software, it isn’t included in Ubuntu repository. We can download VeraCrypt Linux installer from official website. I use Ubuntu 20.04 desktop, so I download the .deb file for Ubuntu 20.04.

How to Verify PGP Signature of Downloaded Software on Linux - LinuxBabe (1)

On the VeraCrypt download page, you can also find the PGP public key and PGP signature download link. Click the links to download these two files. You can run the following command to download PGP public key of VeraCrypt.

wgethttps://www.idrix.fr/VeraCrypt/VeraCrypt_PGP_public_key.asc

Before you do anything with the public key, you must always check the key’s fingerprint to see if it’s the correct key. Display the fingerprint of the key using the command below.

gpg --show-keys VeraCrypt_PGP_public_key.asc

The second line of the output is the key’s fingerprint.

How to Verify PGP Signature of Downloaded Software on Linux - LinuxBabe (2)

If you are using a very old version of GPG (gpg --version) like 1.4.20, then use the following command to display the fingerprint.

gpg --with-fingerprintVeraCrypt_PGP_public_key.asc

Compare it with the fingerprint published on VeraCrypt website.

How to Verify PGP Signature of Downloaded Software on Linux - LinuxBabe (3)

As you can see, the two fingerprints are identical, which means the public key is correct. So you can import the public key to your GPG public keyring with:

gpg --import VeraCrypt_PGP_public_key.asc

How to Verify PGP Signature of Downloaded Software on Linux - LinuxBabe (4)

Now verify the signature of the software installer file using the command below. You need to specify the signature file (.sig) and the software installer file. This is a detached signature, meaning that the signature and software are in separate files.

gpg --verify veracrypt-1.24-Update7-Ubuntu-20.04-amd64.deb.sig veracrypt-1.24-Update7-Ubuntu-20.04-amd64.deb

The output should say “Good Signature”.

How to Verify PGP Signature of Downloaded Software on Linux - LinuxBabe (5)

How signature verifications works:

  • The signature is a hash value, encrypted with the software author’s private key.
  • GPG uses the public key to decrypt hash value.
  • GPG calculates the hash value of VeraCrypt installer and compare the two.
  • If these two hash values match, then the signature is good and the software wasn’t tampered with.

If GPG tells you it’s a bad signature, then the software installer was tampered with or corrupted.

Importing Public Key from a Trusted Source

Note that if the software author tells you his/her public key ID on the website, then you can import the public key with the following command, so you don’t have to manually download the PGP public key and import it to your keyring.

gpg --recv-keys <key-ID>

Then display the fingerprint with:

gpg --fingerprint <key-ID>

And compare the fingerprint from output with the one published on website. This is more secure because the public key is imported from a public key server, which by default is set to hkp://keys.gnupg.netin ~/.gnupg/gpg.conf file. There’re hundreds of public keyservers around the world. Ubuntu has their own key server. MIT also has one.

If you see the following error,

gpg: keyserver receive failed: No data

then you can try a different key server, like this:

gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys 0x680D16DE

That’s it!

I hope this tutorial helped you verify PGP signature of software downloads.As always, if you found this post useful, thensubscribe to our free newsletter or follow us on Twitter or like our Facebook page.

Rate this tutorial

[Total: 55 Average: 4.8]

How to Verify PGP Signature of Downloaded Software on Linux - LinuxBabe (2024)

FAQs

How to verify PGP signature in Linux? ›

Checking Digital In Linux:

Step 1: Open a terminal. Step 2: Use the 'gpg' command to check the signature. The 'gpg' command is usually pre-installed in most Linux distributions. If you don't have it, install it using the package manager specific to your distribution.

How to verify the GPG signature of a file? ›

To verify your belief that someone has signed a file, you will need a copy of that person's Public Key, a copy of the file, and a copy of the signature-file that was allegedly created through the interaction of the person's Secret Key and the file. Acquire the Public Key. Import the Public Key into GPG.

How do I verify PGP encryption? ›

Signed messages received by API Gateway can be verified by validating the signature using the public PGP key of the message signer. PGP decryption and verification require two different keys: your own private key for decryption, and the sender's public key for verification.

How do I verify digital signature encryption? ›

To initiate a digital signature verification on a document, one can use the signer's public key to decrypt the hash accompanying the signature. The signed document is decrypted using the same public key generated by the DSC. This process is crucial in helping verify the authenticity of the digital signature.

What command would be used to check the GPG signature on a downloaded source file? ›

To check the signature use the --verify option. To verify the signature and extract the document use the --decrypt option.

What is GPG check in Linux? ›

GPG stands for GNU Privacy Guard, or GnuPG, a free software package used for ensuring the authenticity of distributed files. For example, a private key (secret key) locks the package while the public key unlocks and verifies the package.

How is a signature verified? ›

Manual signature verification uses humans to compare signatures. Software verification tools also compare presented signatures with reference signatures. They use image processing, pattern recognition and machining learning to look for minute variations between the two signatures.

What is the difference between GPG and PGP? ›

PGP is closed-source and proprietary, while GPG is open-source and free software. Meaning the former typically requires licensing fees, while the latter doesn't. You're free to view and modify the GPG source code.

How do I verify my signature on PKI? ›

To verify the authenticity of the digital signature, the recipient uses the signer's public key, which is accessible to everyone. The recipient decrypts the digital signature using the public key and compares the resulting hash value with a newly generated hash value from the received digital data.

How do I verify an encrypted digital signature? ›

To verify digital signatures and encryption, click on the indicator or icon next to the sender's name or address to check the details of the key or certificate, such as the issuer, expiration date, fingerprint, and trust level.

How to verify gpg signature iso? ›

To verify an ISO file using GPG signature, you need to download the GPG signature file from the developer's website. The GPG signature file will contain the developer's public key and the signature of the ISO file.

How do you verify a signature? ›

When someone attempts to verify the signature, the process involves decrypting the signature using the signer's public key, generating a hash from the received document, and comparing it to the original hash. If they match, the signature is valid.

Top Articles
Latest Posts
Article information

Author: Zonia Mosciski DO

Last Updated:

Views: 6207

Rating: 4 / 5 (71 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Zonia Mosciski DO

Birthday: 1996-05-16

Address: Suite 228 919 Deana Ford, Lake Meridithberg, NE 60017-4257

Phone: +2613987384138

Job: Chief Retail Officer

Hobby: Tai chi, Dowsing, Poi, Letterboxing, Watching movies, Video gaming, Singing

Introduction: My name is Zonia Mosciski DO, I am a enchanting, joyous, lovely, successful, hilarious, tender, outstanding person who loves writing and wants to share my knowledge and understanding with you.