Generating GPG keys

GPG key

Overview

GPG (GNU Privacy Guard) It's a method used for encrypting and decrypting digital files and communications over the internet.

Introduction

The following document will outline how to generate one to be used for encryption of backups(duplicity) or any other use.

Pre-requisite

Ensure you have gpg installed in your machine and its version 2.1.17 or greater

gpg --version

if you not you can install it using the below on ubuntu but for other distros kindly download from https://www.gnupg.org/download/

sudo apt install gnupg

Generate GPG key

gpg --full-generate-key
  1. On the menu prompt select the default RSA and RSA (default) unless there are other explicit requirements.

  1. What keysize do you want? Enter the desired or use default

  2. Select key expiry period. Choose the desired or use default.

  1. Confirm your choices and press enter.

  1. The prompt will require you to enter the identity for your key. Enter any name must be at least 5 characters long.

  1. Then enter your email address on the next prompt then enter

  2. Then enter a comment on the next prompt then enter

  3. Finally, confirm all your entries.

  1. You'll be presented with a password dialog, enter a secure password.

Export public key (-pub.key)

  1. List the keys

NOTE: Key-ID can be in SHORT (8 last digits) or LONG (16 last digits) for the example above SHORT 1F660965, LONG 3B10AA311F660965 and then the fingerprint 3775D234D1729924919064E33B10AA311F660965

  1. Export public key

Export private keys (-priv.key)

  1. List the keys

  1. Export the secret key

Export ultimate keys (-ultimate.trust)

Pick the fingerprint of your key-id from the list

DONE!!


Import the key

Delete the key