How to Create a GPG Key

How to create a GPG key

If you don’t need cPanel, don't pay for it. Only pay for what you need with our scalable Cloud VPS Hosting.

check markCentOS, Debian, or Ubuntu check markNo Bloatware check markSSH and Root Access

In this article, we’ll show you how to create a GPG key on your computer or on your server in order to take advantage of the benefits of public key cryptography. Since cryptography is a very broad topic, this article is limited to showing you how to create a key. However, the basics of using public and private keys is explained in more detail in the complete guide on email encryption.

You can use your GPG key for many operations, but in most cases, these keys are ideal for encrypting and decrypting files as well as “signing” various items to prove that they came from you. In a typical trust situation, you can prove your identify because only you would have access to the private key.

How to Create a GPG Key

The GNU Privacy Guard suite of software tools carries with it a wide variety of software applications. This article introduces you to the basics of creating your own GPG key. When you have a moment, you should read up on all of the things you can do with your key.

To start the process of creating your key you must open a terminal prompt on your computer or log into your server via SSH.

At the command prompt type:

gpg --gen-key

Then you will be prompted to select your key type. The default configuration is recommended. Choose the corresponding number by typing it in.

Select the key size. 2048 is the acceptable default.

Next, select your expiration preference. You can choose a time period or decide to have no expiration date. For example, if you chose 7 days as the expiration you would type 7 and confirm by typing y for “yes.”

Input your name as the “real” name, followed by your email, and a comment about this key. Verify the information is correct and type O for “OK,” when ready.

Finally, you will need to enter a strong passphrase for this key. If you’re unsure about how strong your passphrase is be sure to read our complete guide on designing a strong passphrase.

Final Steps For Completing Your Key

You are almost done. It takes a few moments for the key to produce enough entropy to create itself. Feel free to use your computer to complete other tasks. When complete, you will see a success message in your terminal:

gpg: key 64DBC50F marked as ultimately trusted public and secret key created and signed.  
gpg: checking the trustdb 
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model gpg: depth: 0  valid:   3  signed:   1  trust: 0-, 0q, 0n, 0m, 0f, 3u 
gpg: depth: 1  valid:   1  signed:   0  trust: 1-, 0q, 0n, 0m, 0f, 0u 
gpg: next trustdb check due at 2017-11-22 
pub   2048R/64DBC50F 2017-11-16 [expires: 2017-11-23]       
      Key fingerprint = F0A6 FBC3 6FD0 FDFD EA5A  BDF0 E1A3 CFAC 64DB C50F 
uid                 Joe Example (example key) <[email protected]> 
sub   2048R/0AA4A1E4 2017-11-16 [expires: 2017-11-23]

Well done! You now know how to create a GPG key in your computer or your server.

More on Security and Encryption

CM
Christopher Maiorana Content Writer II

Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog.

More Articles by Christopher

Was this article helpful? Join the conversation!

Questions about our MailChannels Deployment? We have answers and are here to help!Learn More
+