Secure communications with GPG

Ensuring secure communications over an insecure medium such as the Internet is vital. GnuPG ( is an encryption tool that can be used to ensure the security of messages and files sent to others. Compatible with the popular PGP encryption program, it uses the public-key cryptography method, which relies on two ‘keys’ to protect a message.

It is important to understand how public-key cryptography works before we get started with GnuPG. The two keys are known as the private key and public key. The private key is kept by its owner and is protected by a passphrase; the public key is distributed freely to anyone. A message encrypted with one key can only be decrypted using the other. This allows for two forms of communication, providing different types of security:

  • A message can be encrypted by its owner using a private key, and must be decrypted using the corresponding public key. This form verifies the origin of the message, as it could only have come from the owner of the private key. It does not control who can read the message, as the public key used to decrypt it is openly available.
  • A message can be encrypted by someone using its intended target’s public key, and must then be decrypted using its target’s private key. This form ensures the message can only be read by its intended target. It does nothing to verify that the origin of the message is authentic. These methods outlined can be combined to ensure both source verification and security against unauthorised viewing.

Getting started with GnuPG

After installing GnuPG and GPA, you should initialise GnuPG by typing in a shell:
$ gpg

This will create the directories GnuPG needs to work properly. Now you can start the GNU Privacy Assistant (GPA) by running ‘gpa’ while in X11.

To generate your keypair, click on the Keys menu and select Generate key. You will be asked to provide an identifier for your key, consisting of your name, e-mail address and a comment. A passphrase is also needed to protect against someone else using your private key. The passphrase should not be a word or name that can be found in a dictionary and, ideally, should consist of a random combination of mixed-case alphabetic letters and numbers. Once you have entered an identifier and passphrase, a keypair will be generated for you. This may take several seconds, even on a fast computer.

Before you can start encrypting and sharing files, you need to distribute your public key. Your public key is required by others to communicate with you securely. The easiest way to distribute your public key is by using a plain text signature. This can be generated by clicking the Export button in GPA and typing in a filename next to ‘Export to file’. You should put this file in a public place, such as your personal Web page, and direct others to it. You can also export your key to a public key sever where it can be obtained by others using the information in the key’s identifier. You can import other users’ keys by using the Import button.

Using GnuPG

To get started with GnuPG, open the GPA file manager by clicking on Windows and selecting Filemanager. Encrypting a file is easy with the Filemanager. Click the Open button and select the file to be encrypted. Once selected, the file will appear in the Filemanager with a status listed as ‘clear’. To encrypt the file, click the Encrypt button. Select your key from the list and click OK. A new copy of the file will be made with the suffix .gpg to indicate an encrypted version. The new copy will be listed in the file manager with a status of ‘encrypted’.

To decrypt a file, you will need either the public key from its sender or your own private key, depending on the form of encryption used. To decrypt a file, select it in the file manager and click the Decrypt button. If it has been encrypted with your public key, you will need to supply your private key passphrase. If decryption is successful, a newly decrypted copy of the file will appear in the file manager list with a status of ‘decrypted’.

Most popular Linux e-mail programs support the use of GnuPG, such as Evolution, KMail and mutt. You will need to supply the path to the ‘gpg’ binary in each program’s configuration settings. E-mail programs combine both forms of encryption to protect messages so you must obtain your intended targets’ public key before sending them a message. You can try it out by sending yourself an encrypted e-mail.

Join the PC World newsletter!

Error: Please check your email address.

Our Back to Business guide highlights the best products for you to boost your productivity at home, on the road, at the office, or in the classroom.

Keep up with the latest tech news, reviews and previews by subscribing to the Good Gear Guide newsletter.

Alastair Cousins

PC World
Show Comments

Cool Tech

Crucial Ballistix Elite 32GB Kit (4 x 8GB) DDR4-3000 UDIMM

Learn more >

Gadgets & Things

Lexar® Professional 1000x microSDHC™/microSDXC™ UHS-II cards

Learn more >

Family Friendly

Lexar® JumpDrive® S57 USB 3.0 flash drive 

Learn more >

Stocking Stuffer

Plox Star Wars Death Star Levitating Bluetooth Speaker

Learn more >

Christmas Gift Guide

Click for more ›

Most Popular Reviews

Latest News Articles


GGG Evaluation Team

Kathy Cassidy


First impression on unpacking the Q702 test unit was the solid feel and clean, minimalist styling.

Anthony Grifoni


For work use, Microsoft Word and Excel programs pre-installed on the device are adequate for preparing short documents.

Steph Mundell


The Fujitsu LifeBook UH574 allowed for great mobility without being obnoxiously heavy or clunky. Its twelve hours of battery life did not disappoint.

Andrew Mitsi


The screen was particularly good. It is bright and visible from most angles, however heat is an issue, particularly around the Windows button on the front, and on the back where the battery housing is located.

Simon Harriott


My first impression after unboxing the Q702 is that it is a nice looking unit. Styling is somewhat minimalist but very effective. The tablet part, once detached, has a nice weight, and no buttons or switches are located in awkward or intrusive positions.

Featured Content

Latest Jobs

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?