Search This Blog

Tuesday, November 13, 2018

How to Set Up GPG Keys

To install GPG:

$ sudo yum -y install gnupg
or
$ sudo apt-get install gnupg

$ gpg --gen-key
gpg (GnuPG) 1.4.16; Copyright (C) 2013 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Please select what kind of key you want:
   (1) RSA and RSA (default)
   (2) DSA and Elgamal
   (3) DSA (sign only)
   (4) RSA (sign only)
Your selection? 1
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048) 4096
Requested keysize is 4096 bits
Please specify how long the key should be valid.
         0 = key does not expire
      <n>  = key expires in n days
      <n>w = key expires in n weeks
      <n>m = key expires in n months
      <n>y = key expires in n years
Key is valid for? (0)
Key does not expire at all
Is this correct? (y/N) y

You need a user ID to identify your key; the software constructs the user ID
from the Real Name, Comment and Email Address in this form:
    "Heinrich Heine (Der Dichter) <heinrichh@duesseldorf.de>"

Real name: your real name here

Email address: your_email@address.com

Comment: Optional comment that will be visible in your signature

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O

Enter passphrase: Enter a secure passphrase here (upper & lower case, digits, symbols)

At this point, it will need to generate the keys using entropy. This is basically a term to describe the amount of unpredictability that exists in a system. GPG uses this entropy to generate a random set of keys.

It is best to open a new terminal and do some work, and just use the machine as much as possible to let it generate the needed entropy.

This process may take a long time, depending on how active you can make your system.