GAURAV KUMAR

Thursday, April 8, 2010

GPG encryption

recently I came to know about GPG encryption.It means Gnu Privacy Guard.GPG is a command line tool with features for easy integration with other applications also.GPG is mostly used for secure communication and storing data in encrypted form.There are other uses also which I am not discussing right now.

Actually when I was filling a form for account in a site,I was asked for pgp/gpg public key and then I started wandering around to search for it.It is open source and mostly used in command line which I like.There is a windows version of it also.There are so many online pages with uncountable words for its description that I got confused sometime.But finally I figured out the theory behind it.It is like this.

There are 2 type of keys generated by gpg.One is public and another is private.Public keys can be distributed to your friends and published anywhere.With public gpg keys someone can encrypt the message and send it to you.Now, to decrypt it we need the private key which is only with you.So this way emails can be securely sent.Even if somebody sniffs the mail in the middle,It will be secure because the attacker will not have the private key to decrypt it.To create your own key pair just type gpg --gen-key in command line and follow rest instruction(You will mostly choose default values).This way you can export your public keys.But unfortunately my public keys are not working for no reason.I am still looking for answer.


But I did use gpg encryption to my file which is very easy to use and fun to watch.I am going to show what exactly I did.In the terminal just make a simple file. e.g

$ echo "my first encryption" >gen hit enter

$ gpg -e gen it will ask for user ID,use your own user ID

And done! Now hit terminal with ls command and see that there is another file named gen.gpg which is encrypted.Now If you deleted old file named gen then the content can only be viewed by opening gen.gpg which needs password.To decrypt it,put gpg -d gen.gpg in command line and hit enter.Now it will ask for the passphrase which is confidential and it makes the file secure.

1 comment: