First I am asuming that you know what is the use of having Public-Private key pair, if you don’t, well making a long story short it is basicaly used to send messages securely on an non-secure environment such as our so beloved Internet.
So to understand this easily we have to see the Public-Private key system as if they were a physical Padlock and the Key that opens it, where the Public key is the Padlock and the Private one is the Key that opens the Padlock (so Public-Private = Padlock-Key). Now let’s say we have the girl A who whats to send a secret message to the boy B, so first each one is going to buy a Padlock and then send it open to the other one to use it. Then girl A is going to send the message locked with boy B’s Padlock and since he is the only one that holds the Key to open it, she makes sure that ONLY boy B will read the message. Then boy B in order to respond her could do the same but using her Padlock (Public key).
So this is how the system works, the only difference between the physical Padlock-Key and the Public-Private key is that we don’t send the Padlock open like in the example. What we do is that we put our Public key (or open Padlock) in a server so with this anyone can use our “Padlock” to send us stuff in a secure way.
Now we have understood this. I’m going to explain how to generate this Private-Public keys using the GPG packages which is a suite of cryptographic software. After installing this packages in the OS of your choice (in my case ubuntu), to create your key pair you do it with the following
$ gpg –gen-key
This will ask you some things like the type, the lenght in bits and validity time in which you should put RSA for the type, then for the size I chose 4096 bits (the longer the better) and the validity as you want it to be. Finaly it will ask your name and an email, and thats it!. After a while that takes to the GPG generate the keys using aleatory bytes, you are done.
It’s important to take the ID of your key that will appear after you generate it in order to upload it into the server. The key ID will appear after “4096R/” if your key is 4096 bits and RSA, for example if my key ID is GE0I7IFE, it will appears as “pub 4096R/GE0I7IFE 2010-01-18”
Then the final step would be to upload the Public key to a server, so to do this you do it with
$ gpg –keyserver pgp.rediris.es –send-keys GE0I7IFE
where “pgp.rediris.es” is the name of the server and “GE0I7IFE” is the name of your key and with this you are ready to comunicate in a not so vulnerable form.
Posted on December 26, 2011
0