How to Create a GPG Key
- 1). Open a terminal window so you can work from the command line.
- 2). Type "gpg --gen-key" and press "Enter."
- 3). Select an RSA or DSA/Elgamal key. Both are widely supported. The patent encumbrances that once limited RSA adoption are no longer an issue, though many people still prefer DSA/Elgamal. You may also choose a "signing only" key if you do not plan to use the key for encryption and decryption.
- 4). Select your key length (size). Your key should be no less than 1024 bits, but 2048 or higher is recommended. Longer keys are more difficult to crack, but also take longer to process. Unless you are encrypting and decrypting large files, though, you probably won't notice a significant difference on newer computers. Choose a key length appropriate to the type of data you will be protecting.
- 5). Set the key's expiration (or choose not to use one). Once a key expires, it will no longer be valid for signing or having data encrypted. Having keys expire good security practice. If a key is compromised, expiration limits the amount of time it can be abused.
- 6). Confirm the key's expiration date and time.
- 7). Enter the name you want to be associated with this key, along with an optional email address and a comment. It's a good idea to associate an email address so that people with the key know how to reach you -- or if you want to later publish your public key to a public key server. Use a pseudonym if you plan to remain anonymous.
- 8). Enter a strong passphrase. This is the weakest link in the security. The strongest encryption algorithm with the longest key length is virtually useless with a weak passphrase. Don't use dictionary words, use upper and lower-cased letters, numbers and symbols.
- 9). Use your computer while gnuPG generates your keys. Performing other tasks on the computer adds more randomness to the process, making your key stronger.
- 10
Share your public key. You can share it with only a select group, or share it with the world through a public key server. Anyone with your public key can then encrypt messages or files to you as well as verify your digital signature on anything you sign with your private key.
Source...