Simply put, GPG keys are used to encrypt information. To “encrypt information” means to make the information secure in a way that only a particular person can see what it contains. In other words, you lock the information and only the person having the key to the lock can open it.
Use Case 1: Bank account information over emails
Never send your bank account information (your account number, the name on the account, type of account, card number etc.) by email. Don’t even send the bank/branch you hold accounts in. Nothing – just don’t send any information at all over email.
So then how do you send information if you need to? Use GPG. Follow these simple steps:
- Put your account information in a text file (using your favorite text editor).
- Save the file and call it, say, account.txt.
- Run these commands (on your Linux/Unix/FreeBSD box):
# curl -L 'https://fryol.net/r/rishi-public-key' | gpg --import # gpg --output account.gpg -r 0x0B5267B1E3662EBB --encrypt account.txt
If you try and open account.gpg in the same text editor, you would see some garbage in there, which can now only be decrypted by the person whose key you used to encrypt account.txt.
Command 1 (of step 3) was where you downloaded my key (hosted on the link http://fryol.net/?u=key) and imported it into your gpg keyring.
Command 2 (of step 3) was to tell gpg to use 0x0B5267B1E3662EBB (which is a public key identifier of the key you imported) to encrypt the file account.txt.
For people who use Windows, there’s an easier way out: http://gpg4win.org/. The steps above would be very similar – I am sure there would be a way to import a key into that program using a URL. So then, all you do is provide it the URL of the person whose key you want to import and it should be able to use that key.
The file account.gpg is now ready to be sent over email (to the person whose key you imported in command 1 of step 3).
This tutorial is only about encryption – decryption is a separate topic. (..and my primary motive for this post is to let people emailing me quickly encypt stuff).
See also: [http://www.madboa.com/geek/gpg-quickstart/#tosomeone].