Linux OpenPGP - Kleopatra Tutorial

Kleopatra logo

OpenPGP is an encryption and authentication standard based on Phil Zimmermann's first PGP implementation. In this tutorial, we'll look at GnuPG, the native Linux OpenPGP implementation. However, since GnuPG is a command line tool, which may be esoteric to some, we'll use a graphical user interface (GUI) of GnuPG called Kleopatra. If you want to know how PGP works, click here.

1. Installing GnuPG

• First things first, you need to have GnuPG installed on your Linux system. GnuPG is usually pre-installed on most Linux distributions. However, if for some reason it's not, run the command:

sudo apt-get install gnupg

• If you're running a non-Debian-based Linux distro such as Fedora, run:

sudo yum install gnupg

2. Installing Kleopatra

• On Debian-based distros run the following to install Kleopatra:

sudo yum install kleopatra

• On non-Debian-based distros, run:

sudo yum install kleopatra

3. Generating A New Key Pair

• Upon launching Kleopatra, you'll see this window. Click on 'New Key Pair':

Kleopatra PGP generate key

• In this screen, we're asked to enter a name and an email (email is optional). Enter a name and click 'Create' on the next window.

Kleopatra PGP name email Kleopatra PGP review parameters

• Now we're asked to enter a password. This password is used to guard your PGP private key, which is critical, so make sure it's a decent password.

Kleopatra PGP enter password

• At this point, Kleopatra will be generating a key pair for you. Wiggle your mouse a bit to give the tool some randomness to use.

Kleopatra PGP creating key pairs

• Now that the pair has been generated, click finish.

Kleopatra PGP keypair created

4. Exporting Your Public Key

What you will likely need to do now is give your public key to other people so that they could encrypt messages directed at you.

• Kleopatra will be showing a screen with an entry of the key pair you've just created. Right click on the entry and choose 'Export' to export your public key:

Kleopatra PGP exporting key step 1

• The exported public key file will have a '.asc' extension. You can now give this file for others to communicate securely with them. You can also open the '.asc' file with a text editor and copy/paste the key liberally:

Kleopatra PGP exporting key step 2

5. Decrypting A Message From The Clipboard

Say we've received a message or an email that was encrypted by the sender with our Public key that we generated in the previous section. A simple way to decrypt the message is copying the whole message into the clipboard and then heading to Kleopatra.

• Here's the encrypted message, we copy it to the clipboard:

Kleopatra PGP decrypt message step 1

• Then we head to Kleopatra, click on tools, choose clipboard from the drop menu, and then decrypt:

Kleopatra PGP decrypt message step 2

• Kleopatra will decrypt the message and store back into the clipboard. We can see the decrypted plain-text message by pasting it anywhere:

Kleopatra PGP decrypt message step 3




Aug. 28, 2022