Red Hat Linux 7.3: The Official Red Hat Linux Customization Guide | ||
---|---|---|
Prev | Appendix B. Getting Started with Gnu Privacy Guard | Next |
To begin using GnuPG, you must first generate a new keypair: a public key and a private key.
To generate a keypair, at a shell prompt, type the following command:
gpg --gen-key |
Since you work with your user account most frequently, you should perform this action while logged in to your user account (and not as root).
You will see an introductory screen, with key options, including one recommended option (the default), similar to the following:
gpg (GnuPG) 1.0.1; Copyright (C) 1999 Free Software Foundation, Inc. This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions. See the file COPYING for details. Please select what kind of key you want: (1) DSA and ElGamal (default) (2) DSA (sign only) (4) ElGamal (sign and encrypt) Your selection? |
In fact, most of the screens which require you to choose an option will
list the default option, within parentheses. You can accept the default
options simply by pressing
In the first screen, you should accept the default option:
(1) DSA and ElGamal. This option will
allow you to create a digital signature and encrypt (and decrypt) with
two types of technologies. Type 1 and then
press
Next, choose the key size, or how long the key should be. Generally, the
longer the key, the more resistant against attacks your messages will
be. The default size, 1024 bits, should be sufficiently strong for most
users, so press
The next option asks you to specify how long you want your key to be valid. Usually, the default (0 = key does not expire) is fine. If you do choose an expiration date, remember that anyone with whom you exchanged your public key will also have to be informed of its expiration and supplied with a new public key.
Your next task is to provide a user ID, with your name, your email address, and an optional comment. When you are finished, you will be presented with a summary of the information you entered.
Once you accept your choices, you will have to enter a passphrase.
Tip | |
---|---|
Like your account passwords, a good passphrase is essential for optimal security in GnuPG. For example, mix your passphrase with uppercase and lowercase letters, use numbers, or punctuation marks. |
Once you enter and verify your passphrase, your keys will be generated. You will see a message similar to the following:
We need to generate a lot of random bytes. It is a good idea to perform some other action (type on the keyboard, move the mouse, utilize the disks) during the prime generation; this gives the random number generator a better chance to gain enough entropy. +++++.+++++.++++++++....++++++++++..+++++.+++++.+++++++.+++++++ +++.++++++++++++++++++++++++++++++++++++++..........................++++ |
When the activity on the screen ceases, your new keys will be made and placed in the directory .gnupg in your home directory. To list your keys, use the command:
gpg --list-keys |
You will see something similar to the following:
/home/newuser/.gnupg/pubring.gpg ----------------------------------------- pub 1024D/B7085C8A 2000-04-18 Your Name <you@yourisp.net> sub 1024g/E12AF9C4 2000-04-18 |