GAURAV KUMAR

Saturday, April 10, 2010

GPG public key

Hi,
As I was searching why my gpg public key is not working,I suddenly found answer.Actually gpg public key contains some extra words also which I neglected.public key can be viewed in terminal by typing :

gpg --armor --export [your public key id]

Now complete output is the public gpg key including "-----BEGIN PGP PUBLIC KEY BLOCK-----" and "-----END PGP PUBLIC KEY BLOCK-----".Initially I was taking only middle part.One more thing public key requires public key id which can be viewed by typing "gpg --list-keys". The pub part shows id.This command displays whole list of keys.So, if someone has made more than one key pairs,then it is useful to see which public key is for which public key id.As I successfully generated my public key, I am going to share it. It is right below :-

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.9 (GNU/Linux)

mQGiBEu+azsRBACGVGTbi3GHDKa8rkzOWP8lQYg0omH6mU5tIHe+0fLiTMRzbr1o
/lTT2w+GksRhziWL03+zTc36R/gNAPJvp8djhaeDpYD0DCh1JuFNLPAZWVMQ1TJf
INgQ59KoBr/sWHWa0DXTFoTK1o/0wLsUioH54nN4rfxsPQgKMA5f/FYEzwCgitK5
WeQWsm8RMkZURaROcq7kHE0D/0GsXazBA0n+iQFVbbjblOpzs0/nvJfnEWKEbyCv
e9NUrbNqvttA501uy+VeIlMIbVzIOHAMeIpgWMT+z6vVYcBmKrZGCRv0i9gBzrd/
8HVWbVrZDwz7Mk076f/1wo5iLv9OP657O6i3B4F/1fiBmJubTQkXgL5nKwu1iQvj
wTfDBACAcLMha0rBLji4l3MCHpwYVb/vCs1OsGWmDlRElkST6zqv8bg9/O2AZqgE
fewe8ZqcYyRMlElsoqXlL0z+JZykCp4QUGwajB/oWCdecFK09uOU518Os90wLjro
LvAZmebkmoR2gsy3J9QBar7Lp63Y1AfxZGiCQU9/a5+0OIGCbrQ6Z2F1cmF2IGt1
bWFyIHlhZGF2IChlbmNyeXB0aW9uKSA8Z2F1cmF2a3VtYXI1NTJAZ21haWwuY29t
PohgBBMRAgAgBQJLvms7AhsDBgsJCAcDAgQVAggDBBYCAwECHgECF4AACgkQdFo6
7FlOrR11+gCbBsVq1jpmwo1JE10bcO5UEWySlRkAn0JuAhWtePIR8pK14NasjSNO
xDg8uQINBEu+azsQCACLKpR8orOIiaooO+fI2IEVFL8Qb+s/9/dfx/asMoBB2bAS
IhpNt6N65a3MtMhDeIZcfafwtpgjxJAuxp1iwWpbEyj2vDWcZ5xpnf3N3hrb8wm9
eBpGnGj7ugETBgNZ/G3aQJsljv6Ze+Ys83wQ20mdXTTIg3Yc/bzlohE0Itl3JgMW
BioI13pxXcWgxcPMBBeeoL0bBGCQOhjCTckjVjoJTrHxXvxqembTeUQ8wG6tnLj7
HIMOtKp9usF83H0qvDhiYjGJ7xI5KplJXyEw9+T1afrHY7KcggMmwOdHvuTrKI62
XIpX3eVFu7zDh5cA7tMtbErSpSZxhskPNPYpQYKzAAMFCACCUEAJHO9FHL9zq7fR
GNcx5o4TaNsplBpq42zFnd14pq1ftxr5SfUVn6ciPVkGnj9v5LVOxib0SJCgcDCw
mGkQ5SmD3XCq/KDqjSlFYacLJOIH/sKMWmkLrF7Nv5o0VrQbSdzPCCWCbNsiFoad
Zb5bGXtOrg2nLj6uIUe5ZM3EUJr/iMFRhZ9Xk4ETTsqyD95yfdM8y+Djnri3bdTg
eL3QriiZu3k0CJGcBu/lYWcVR7wseIUa7LYsLuGhzH3zyFuZHw8NqUls4H7UQel1
dMut5SGo6Ksn0n9UwyKzUe+Eir49efX+gMivn+ttupOZ2t7OcCH6IaCr0Y6E1Iz6
BCveiEkEGBECAAkFAku+azsCGwwACgkQdFo67FlOrR0zFACfdSLkUkkvO++A6XyH
2ItqsnYVgCQAn0iB1mZ1eI7xuUyR6y+teREIc4Bf
=+Uo3

-----END PGP PUBLIC KEY BLOCK-----



And Now I am working on sending a mail with encryption by my private key.Hope,It works.

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.