<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Emmanuella Sule</title>
    <description>The latest articles on DEV Community by Emmanuella Sule (@nerdynene).</description>
    <link>https://dev.to/nerdynene</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1180087%2Ff139e001-6dae-4b05-a957-fb329d8ca9e9.jpeg</url>
      <title>DEV Community: Emmanuella Sule</title>
      <link>https://dev.to/nerdynene</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nerdynene"/>
    <language>en</language>
    <item>
      <title>Extensive Guide to Gnu Privacy Guard (GPG)</title>
      <dc:creator>Emmanuella Sule</dc:creator>
      <pubDate>Sun, 22 Oct 2023 19:44:19 +0000</pubDate>
      <link>https://dev.to/nerdynene/extensive-guide-to-gnu-privacy-guard-gpg-2a11</link>
      <guid>https://dev.to/nerdynene/extensive-guide-to-gnu-privacy-guard-gpg-2a11</guid>
      <description>&lt;p&gt;In this write-up, I'll take you on a tour of what a Gnu Privacy Guard is, what it is used for, how to get it installed, and explore some of its features. This is a detailed guide, so I encourage you to use the table of contents to navigate to the information you need easily.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Table of Content&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What is GPG&lt;/li&gt;
&lt;li&gt;Use Case&lt;/li&gt;
&lt;li&gt;How it Works&lt;/li&gt;
&lt;li&gt;Installing GPG&lt;/li&gt;
&lt;li&gt;Getting your GPG key pair

&lt;ul&gt;
&lt;li&gt;Updating/Renewing a key Expiration date&lt;/li&gt;
&lt;li&gt;Changing a key Passphrase&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Exporting and Importing a key

&lt;ul&gt;
&lt;li&gt;Exporting your public key&lt;/li&gt;
&lt;li&gt;Importing other's public key&lt;/li&gt;
&lt;li&gt;Uploading your key to a key server&lt;/li&gt;
&lt;li&gt;Searching/Retrieving a key from a key server&lt;/li&gt;
&lt;li&gt;Exporting a private key&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Encrypting messages&lt;/li&gt;

&lt;li&gt;Decrypting messages&lt;/li&gt;

&lt;li&gt;Deleting a key&lt;/li&gt;

&lt;li&gt;Conclusion&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is GPG
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Gnu Privacy Guard&lt;/strong&gt;(&lt;strong&gt;GnuPG&lt;/strong&gt; or &lt;strong&gt;GPG&lt;/strong&gt;) is an Open Source version of the &lt;strong&gt;Pretty Good Privacy&lt;/strong&gt;(&lt;strong&gt;PGP&lt;/strong&gt;) Cryptographic software suite that is used for file encryption. GPG is based on the OpenPGP encryption standard which makes it compatible with PGP tools.  &lt;/p&gt;

&lt;h2&gt;
  
  
  Use Case
&lt;/h2&gt;

&lt;p&gt;One common use case of GPG is to encrypt files and email messages. GPG converts plain text into complex code of unreadable characters called ciphertext to ensure the secure transmission of information.  GPG  is also used to sign documents, and Git commits through digital signatures so that the authenticity of messages can be verified.  &lt;/p&gt;

&lt;h2&gt;
  
  
  How It Works
&lt;/h2&gt;

&lt;p&gt;GPG combines symmetric-key cryptography (Secret key) and asymmetric cryptography(Public + Private key) to provide high data protection.&lt;/p&gt;

&lt;p&gt;A public and a private key make up a GPG key pair. The private key, which is to be kept secret, is used to decrypt files and sign messages. The public key can be made available to anyone and is used to verify signed messages(signature) or to encrypt messages.&lt;/p&gt;

&lt;p&gt;Let's understand how GPG works with the following example: &lt;/p&gt;

&lt;p&gt;Say Ammy and John want to share a secret message. Firstly, both of them have to generate their GPG key pair. Then they share their public key either by a &lt;a href="https://en.wikipedia.org/wiki/Key_server_(cryptographic)" rel="noopener noreferrer"&gt;key server&lt;/a&gt; so that each has the other public key in their &lt;strong&gt;Keyring&lt;/strong&gt; ( a special file that stores a group of public keys used by a certificate authority). Ammy creates the message, encrypts it with John's public key, signs the message using her private key, and then sends it over to John. John receives the encrypted message, decrypts it using his private key, and then uses Ammy's public key to verify that the message is truly from Ammy.&lt;/p&gt;

&lt;p&gt;Note that you can only decrypt a message which was encrypted using your public key.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing GPG
&lt;/h2&gt;

&lt;p&gt;First, you have to install the GPG command line utility.&lt;/p&gt;

&lt;p&gt;To verify if you have GPG, run the following command on your terminal:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gpg --version&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If not, follow through the steps to get GPG on your specific OS.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Linux&lt;/strong&gt;&lt;br&gt;
GPG is installed by default on most distributions. If that's not the case, you can install it using your package manager. &lt;/p&gt;

&lt;p&gt;for Debian/Ubuntu:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo apt install gnupg&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;MacOS&lt;/strong&gt;&lt;br&gt;
The easiest way to install GPG on Mac is to use &lt;a href="https://formulae.brew.sh/formula/gnupg" rel="noopener noreferrer"&gt;Mac Homebrew&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;brew install gnupg&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Windows&lt;/strong&gt;&lt;br&gt;
If you are a Windows user by now, you already know that Windows always tends to complicate things, doesn't it?&lt;/p&gt;

&lt;p&gt;If you have GIT BASH installed, then you already have access to GPG. Launch  GIT BASH and run the following command to get the version of gpg installed:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gpg --version&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you don't have GIT BASH installed, you can install Gpg4win (GNU Privacy Guard for Windows)&lt;/p&gt;

&lt;p&gt;When installing &lt;a href="https://gpg4win.org/download.html" rel="noopener noreferrer"&gt;Gpg4win&lt;/a&gt;, you can uncheck the other plugins/components if you intend to use the command line interface. Here is a &lt;a href="https://youtu.be/y_E4uQZh_C4?si=d4sYMDOGK2qKOqh_" rel="noopener noreferrer"&gt;video&lt;/a&gt; I find helpful. &lt;/p&gt;

&lt;h2&gt;
  
  
  Generate GPG Key Pair
&lt;/h2&gt;

&lt;p&gt;To generate your GPG key pair, run the following command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gpg --full-generate-key&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This will start up an interactive question section that will be used to configure your key:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Please select what kind of key you want: go with the default option(1)&lt;/li&gt;
&lt;li&gt;What keysize do you want? Choose 4096. choosing a higher bit reduces the risk of the key being compromised by hackers&lt;/li&gt;
&lt;li&gt;Key is valid for?: 1y ( means it expires after 1 year). It's a good idea to set one as it can be renewed easily. If your key gets compromised or your laptop gets stolen, you won’t have to worry much because the key will just expire on its own. You can also revoke your key as an option if this should happen&lt;/li&gt;
&lt;li&gt;Is this correct? y&lt;/li&gt;
&lt;li&gt;Real name: input your real name&lt;/li&gt;
&lt;li&gt;Email address: &lt;a href="mailto:faith@example.com"&gt;faith@example.com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Comment: Optional comment that will be visible in your signature(you can skip this)&lt;/li&gt;
&lt;li&gt;Change (N)ame, ©omment, (E)mail or (O)kay/(Q)uit?: verify all information are correct and enter "O"&lt;/li&gt;
&lt;li&gt;Enter passphrase: Enter a secure Passphrase. Write this down somewhere, or use a password manager to save it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;At this point, gpg will generate your key using entropy. Entropy refers to the degree of unpredictability and randomness present within a system. To enhance the randomness of the generating key, gpg encourages you to perform some actions like moving your mouse, typing on the keyboard, etc.&lt;/p&gt;

&lt;p&gt;Once your key is generated, you can view it by running the following command. If you have more than one key in your keyring, it will be shown: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;gpg --list-keys&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmbidm3dedg4tmmr6zpm3.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmbidm3dedg4tmmr6zpm3.PNG" alt="gpg list keys"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From the preceding image, the &lt;code&gt;pub&lt;/code&gt; section indicates the &lt;strong&gt;primary key&lt;/strong&gt;. The primary key is the top-level key, and the certificate is identified by the Key ID of the primary key. The &lt;code&gt;sub&lt;/code&gt; section indicates a &lt;strong&gt;subkey&lt;/strong&gt;. A subkey is a key that is stored as a sub-component of another key.&lt;/p&gt;

&lt;p&gt;6A303B4CA0B8AE457715DA82F3FAFC9F22F2713E is called the &lt;strong&gt;fingerprint&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Key ID, which is a shorthand method for referring to a particular key, is of two types, and both are derived from the fingerprint. The 'short' keyid is the low 32 bits, or last 8 hex digits, of the fingerprint and thus is 22F2713E. The 'long' keyid is the low 64 bits, or last 16 hex digits, of the fingerprint and thus is F3FAFC9F22F2713E.&lt;/p&gt;

&lt;p&gt;You can also run the following command to get the short and long keyid:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gpg --list-keys --keyid-format=short&lt;/code&gt;&lt;br&gt;
&lt;code&gt;gpg --list-keys --keyid-format=long&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Updating/Renewing a Key Expiration date
&lt;/h3&gt;

&lt;p&gt;Take the following command if you wish to update your key expiration date:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gpg --edit-key  key-id&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;This will start up an interactive question section:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;key 0: to choose which key to edit&lt;/li&gt;
&lt;li&gt;expire&lt;/li&gt;
&lt;li&gt;key is valid for (0):  2y &lt;/li&gt;
&lt;li&gt;Is this correct?: Y&lt;/li&gt;
&lt;li&gt;enter your passphrase.&lt;/li&gt;
&lt;li&gt;save&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Repeat the preceding process to update the subkey expiration date, but this time, enter key 1.&lt;/p&gt;

&lt;h3&gt;
  
  
  Changing Key Passphrase
&lt;/h3&gt;

&lt;p&gt;The following steps update your key Passphrase:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run &lt;code&gt;gpg --passwd F3FAFC9F22F2713E&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Enter the current passphrase.&lt;/li&gt;
&lt;li&gt;Enter a new passphrase.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Exporting and Importing a Key
&lt;/h2&gt;

&lt;p&gt;GPG will be useless if we can't share our key with the people we wish to communicate with. Up next, we will look at how to export, import, and share GPG keys.&lt;/p&gt;

&lt;h3&gt;
  
  
  Exporting your Public Key
&lt;/h3&gt;

&lt;p&gt;To export your public key from your keyring, run the following command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gpg --export -armor key-id&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;-amor&lt;/code&gt;  or &lt;code&gt;-a&lt;/code&gt; command-line option outputs the public key in ASCII format. &lt;/p&gt;

&lt;p&gt;To export the public key to a file named  &lt;em&gt;public_key.asc&lt;/em&gt;, run the following:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gpg --export -a F3FAFC9F22F2713E &amp;gt; public_key.asc&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you call the &lt;code&gt;ls -a&lt;/code&gt; statement, you will see the file in your current directory. Run &lt;code&gt;cat public_key.asc&lt;/code&gt; to view the file. You can then share this file with a correspondent via email or another appropriate method so they can import it into their keyring.&lt;/p&gt;

&lt;h3&gt;
  
  
  Importing Other User's Public Key
&lt;/h3&gt;

&lt;p&gt;To import a correspondent public key obtained as a text file, named &lt;em&gt;jonh_publickey.asc&lt;/em&gt; to your keyring, run the following command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gpg --import jonh_publickey.asc&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Uploading your Key to a Key Server
&lt;/h3&gt;

&lt;p&gt;Key servers are a good place to upload your public key and share it with others. These key servers are used to house people’s public keys from all over the world. There are many public key servers like &lt;a href="https://keyserver.ubuntu.com" rel="noopener noreferrer"&gt;Ubuntu&lt;/a&gt;, &lt;a href="http://keys.gnupg.net" rel="noopener noreferrer"&gt;GnuPG&lt;/a&gt;, &lt;a href="https://keys.openpgp.org" rel="noopener noreferrer"&gt;OpenPGP&lt;/a&gt;, and &lt;a href="https://pgp.mit.edu" rel="noopener noreferrer"&gt;MIT&lt;/a&gt; key servers. &lt;/p&gt;

&lt;p&gt;To send your public key to a certain key server from within GPG, run the following command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gpg --keyserver &amp;lt;key-server&amp;gt; --send-keys &amp;lt;key-id&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;code&gt;gpg --keyserver pgp.mit.edu --send-keys F3FAFC9F22F2713E&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Searching / Retrieving a Key from a Key Server
&lt;/h3&gt;

&lt;p&gt;You can search for people by name or email from a public key server, then import the keys that you find to your keyring.&lt;/p&gt;

&lt;p&gt;To get a correspondent public key from a key server, you first search for their public key by name or email and then retrieve the public to your keyring:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gpg --keyserver &amp;lt;key-server&amp;gt; --search-keys &amp;lt;search_parameter&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;code&gt;gpg --keyserver pgp.mit.edu --search-keys faith@example.com&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If the search returns more than one key, you can specify the number(s) to indicate which key would be imported.&lt;/p&gt;

&lt;p&gt;If you know the key ID of a correspondent, you can retrieve its public key from a certain key server:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gpg --keyserver &amp;lt;key-server&amp;gt; --recv-keys &amp;lt;digit-key-id&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;code&gt;gpg --keyserver pgp.mit.edu --recv-keys F3FAFC9F22F2713E&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Exporting a Private Key
&lt;/h3&gt;

&lt;p&gt;If you want to use the same GPG key across different machines, you should export your private key as well as your public key. To do this, run the following command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gpg --export-secrete-key -a &amp;gt; private_key.asc&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You will need to enter a passphrase to export the private key. This passphrase will also be used while importing the private key.&lt;/p&gt;

&lt;h2&gt;
  
  
  Encrypting messages
&lt;/h2&gt;

&lt;p&gt;If you have a message written in a file named &lt;em&gt;message.txt&lt;/em&gt; you may want to encrypt it and send it to a correspondent. To encrypt a file, run the following command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gpg -r F3FAFC9F22F2713E -a -e message.txt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;-e&lt;/code&gt; or &lt;code&gt;--encrypt&lt;/code&gt; command option encrypts the file. The &lt;code&gt;-r&lt;/code&gt; or &lt;code&gt;--recipient&lt;/code&gt; option specifies the recipient key ID and the &lt;code&gt;-a&lt;/code&gt; option outputs the file in ASCII format.&lt;/p&gt;

&lt;p&gt;The file is encrypted with the public key of key ID F3FAFC9F22F2713E and will need the corresponding private key to decrypt the message. The output of the command is stored in a file named &lt;em&gt;message.txt.asc&lt;/em&gt;. Again, use the &lt;code&gt;ls -a&lt;/code&gt; statement to view this.&lt;/p&gt;

&lt;p&gt;To  encrypt a message for more than one person, run the following command:&lt;br&gt;
&lt;code&gt;gpg -r&amp;lt;key-id-1&amp;gt;-r&amp;lt;key-id-2&amp;gt; -a -efile.txt&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Decrypting Messages
&lt;/h2&gt;

&lt;p&gt;To decrypt a message in a file named &lt;em&gt;reply.txt.asc&lt;/em&gt;, the &lt;code&gt;-d&lt;/code&gt; or &lt;code&gt;--decrypt&lt;/code&gt; command option is used. GPG will automatically select the appropriate private key to decrypt the message. You will also need the passphrase of the associated private key.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gpg -d reply.txt.asc&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To decrypt and write the output to a file named  reply.txt run the following command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gpg -d reply.txt.asc &amp;gt; reply.txt&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Signing and Verifying a File
&lt;/h2&gt;

&lt;p&gt;As one of the uses of the GPG key pair, you can sign a message to approve it or verify a signature to check its authenticity. To sign a file and not necessarily encrypt it, use the &lt;code&gt;--sign&lt;/code&gt; option. The output of the following command would be in a &lt;code&gt;.gpg&lt;/code&gt; (binary) format:&lt;/p&gt;

&lt;p&gt;gpg &lt;code&gt;--sign message.text&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To convert the output of a signature file to an ASCII format, use the &lt;code&gt;--clearsign&lt;/code&gt; command option.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gpg --clearsign message.txt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To verify a signature, use the &lt;code&gt;--verify&lt;/code&gt; option or &lt;code&gt;--decrypt&lt;/code&gt; option( even though the file is not encrypted):&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gpg --verify message.txt.asc&lt;/code&gt;&lt;br&gt;
&lt;code&gt;gpg --decrypt message.txt.asc&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you want to encrypt and also sign a file, run the following command:&lt;br&gt;
&lt;code&gt;gpg --sign -r F3FAFC9F22F2713E -a -e message.txt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Detached Signing&lt;/strong&gt;&lt;br&gt;
Until now, we have only encountered signatures that are embedded into the file along with the message. However, it is also possible to have a detached signature file that is separate from the message file. This type of signature is called a detached signature.&lt;/p&gt;

&lt;p&gt;They're most common for verifying software to ensure that nobody has tampered with the application other than the actual developer(s) who've signed it.&lt;/p&gt;

&lt;p&gt;To create a detached signature, the &lt;code&gt;--detach-sign&lt;/code&gt; or &lt;code&gt;-b&lt;/code&gt; command option is used&lt;br&gt;
&lt;code&gt;gpg --detach-sign message.txt&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Verify
&lt;/h3&gt;

&lt;p&gt;There are two ways to verify a detached signature:&lt;/p&gt;

&lt;p&gt;1) When the original file(message file) has the same name as the signature file; If the signature file has the same filename as the message file but ends in either &lt;code&gt;.asc&lt;/code&gt; (ASCII Armoured) or &lt;code&gt;.gpg&lt;/code&gt; (raw binary), then you can simply pass the signature's name to gpg, and it will auto-detect the message filename.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gpg --verify message.txt.asc&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;2) When the signature file and the message file have different names or are located in different directories, it is important to provide gpg with the names of both files. Place the signature's file name after &lt;code&gt;--verify&lt;/code&gt;, and then the original filename after that. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;gpg --verify message.txt.asc message.txt&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Deleting a Key
&lt;/h2&gt;

&lt;p&gt;If you wish to remove a correspondent public key or private key from your keyring,  run the following commands:&lt;/p&gt;

&lt;p&gt;To remove the private key:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gpg --delete-secrete-key key-id&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To remove a public key:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gpg --delete-key key-id&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Revoking a GPG Key
&lt;/h2&gt;

&lt;p&gt;If your GPG key pair gets compromised or you lose access to your secret key, you would want to revoke or nullify the key.&lt;/p&gt;

&lt;p&gt;From GPG 2.1 and above, a revocation certificate is created by default when you create a GPG key pair. For every key pair created using this version, an ASCII armored revocation certificate is generated and saved in a file located in the &lt;code&gt;openpgp-revocs.d&lt;/code&gt; directory. This directory can be found within the GnuPG home directory. Each certificate is named after the fingerprint of the corresponding key. &lt;/p&gt;

&lt;p&gt;To revoke your key, import the revocation certificate&lt;br&gt;
&lt;code&gt;gpg --import revoke-certificate-name.rev&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;It is advisable to back up this revocation certificate in a secure and separate location in case your computer gets stolen.&lt;/p&gt;

&lt;p&gt;Before I conclude, I just want to point out that there are various different ways to specify a correspondent ID to GPG. The following are some various ways to do so:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using the Key ID in its short format.&lt;/li&gt;
&lt;li&gt;Using the key ID in its long format.&lt;/li&gt;
&lt;li&gt;Using the Fingerprint.&lt;/li&gt;
&lt;li&gt;Using the user's email address.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Wow! You now have the knowledge and skills needed to successfully generate your GPG key pair and start using it. Note that this is not an exhaustive guide to GPG features. Instead, it offers a concise introduction to some of the fundamental aspects of the tool. I encourage you to explore the GPG [manpage].(&lt;a href="https://www.gnupg.org/gph/de/manual/r1023.html" rel="noopener noreferrer"&gt;https://www.gnupg.org/gph/de/manual/r1023.html&lt;/a&gt;) &lt;/p&gt;

&lt;p&gt;If you find this article helpful, please Like/share so it reaches others.&lt;br&gt;
Connect with me on:&lt;br&gt;
&lt;a href="https://twitter.com/EllaSule" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;br&gt;
&lt;a href="https://github.com/Nene-S" rel="noopener noreferrer"&gt;Github&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.linkedin.com/in/emmanuella-sule-212b0b224/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Reference Links
&lt;/h3&gt;

&lt;p&gt;Cover image from  &lt;a href="https://www.flickr.com/photos/136770128@N07" rel="noopener noreferrer"&gt;Infosec Images&lt;/a&gt;&lt;/p&gt;

</description>
      <category>gpg</category>
      <category>encryption</category>
      <category>security</category>
      <category>cybersecurity</category>
    </item>
  </channel>
</rss>
