Creating a Key Pair – GUI Client

Previously we looked at creating your key pair using the Linux command line. But if you are on a different platform, or you prefer to use a GUI client in Linux, you do have alternatives. For this example I will use the KGpg client on Kubuntu 13.04. If you have a Windows client, or a GNOME client, the steps are similar and you should be able to follow a similar process.  I installed KGpg from the repository, and opened it:

KGpg at first use

This is the KGpg screen when you first open it, and there is nothing here yet.

So, the first order of business here is to create a key pair. To do this, go to the Keys menu, and select Generate Key Pair…:

Window to generate a key pair.

So, to generate a key pair, start filling in the blanks. Enter your name, email, and a comment. This is the information used to generate your Key ID. Your name and e-mail probably don’t change much, but you could have different keys by using different comments. Or you could have one for business and one for personal use by having different e-mail addresses. Then set the expiration. If you are just getting started and experimenting you might want to set the expiration to something like 1 year. There are ways to extend the life of the key later as long as you have your passphrase and key ID, so don’t worry about it. I set mine for 1 year in this example.

Then you need to select the key size. Under no circumstances should you choose 768 bits if you want any security. That is simply too short for todays’ computers. There are many people who will be fashionably cynical and claim that you can’t really be secure because the NSA has billions of dollars, big super computers, and a huge data center in Utah. They are wrong, but you do need to understand how you can stay secure. And key length is one of the two parameters you need to be secure. 768 is easy to break, and 1024 is possible with the right equipment. Right now NIST says that 2048 is secure until 2030 based on the rate at which they expect computing power to grow, but if you distrust them note that 4096 is even more secure. And it is not just twice as secure, it is 3.23×10^616 times more secure. We are talking about a brute force attack that would require every computer in existence working for billions of years to crack the encryption. In this case, I decided 2048 would be enough for my purposes. 4096 bits does have a couple of drawbacks (potentially). First, it can take a bit longer to encrypt and decrypt data with the longer key. Second, I have seen reports that some smart cards cannot handle 4096-bit keys. Know your options and choose what works for you.

Finally, you need to choose the encryption algorithm.l You have several choices. Basically, when you see two items on the same line, that means one key for signing, and another for encryption uses. We want to do both, so that means either DSA & ElGamal, or RSA & RSA. The difference is essentially which one-way mathematical function they use, but if you are not an expert I would say it doesn’t particularly matter. I chose RSA & RSA for my key pair:

Data to generate a key pair

At this point you need only click the OK button. Note that if you click the Expert Mode button it will throw you into a terminal and you will then use command line tools. I assume that if that is what you wanted to do you started there, so for now we will stick to the GUI. When you click OK it will ask you for a passphrase. The thing you want to do is give it a good one. I recommend using something like LastPass to generate a secure passphrase, such as rSn40thF870w (not my real passphrase, obviously).  This gets you to this screen:

Key pair generated in KGpg

Here you see the results. The Key ID in this case is E122BA67.  Also note that it is my default key (not really, this is just an example), and that KGpg has created the revocation certificate for me. Keys never really go away. What a revocation certificate does in effect is add a note on the key server that essentially says “Don’t use this key any longer, it has been revoked.” But the key still exists. And if you have any data you have saved that was encrypted with this key, you can still decrypt that data and read it. Also note that you can print out a copy. The revocation certificate is simply a text file, so if you had saved the text file on a drive that went belly up and you had not backup, having a printed copy would still let you revoke the certificate. Of course, having printed copies can be a security risk to some degree, but again you can take this information decide what is right for you.

If you are creating a revocation certificate you will be asked again for your passphrase, so I hope you were careful about writing it down!

Listen to the audio version of this post on Hacker Public Radio!

 Save as PDF