Hits: 3,975
Home >> Software >> GnuPG/GPG

Intro to GnuPG or GPG

April, 2006

Introduction to GnuPG (http://www.gnupg.org/)

GPG (GnuPG) is the open source version of PGP ® (Pretty Good Privacy) used for encryption. It is most often used for encrypting files and signing and encrypting email. This introduction to GPG will show you how to make your own keys, encrypt/decrypt a file.

Makeing your Keyring

One you install GPG, you need to create your keyring that you will use to encrypt and decrypt messages or files. This is a very easy process. Issue the command:

gpg --gen-key

This will ask you for your name, email address, and then a comment. After you enter these you will be asked for a passphrase. This is the most important part of the process. A good pass-phrase should be good length, something you cannot be associated with. Things like the first verse of your favorite poem or quote are great examples. It should be easy for you to rememeber since you will need to enter this often.

Export your public key

Now that you have a key-ring, you need to export your public key so others can send you encrypted files/email. To do this issue:

gpg --armor --export uid > gpg_key.asc

Where uid is either your email address, or comment. You can now send this to a key-server (see list below) or send it to your friends.

Encrypting a file

To encrypt a file using your key use:

gpg -r uid -e myfile

GPG will ask you to enter your passphrase. Once this is done the default output is sent to myfile.gpg. Very easy, isn't it?

Decrypting a file

At some point, you or someone else will want to decrypt encrypted files.

gpg -r uid -d myfile.gpg > myfile

This will ask for your pass-phrase (unless cache - see .gnupg/gpg.conf). Also note, that you can use -o myfile instead of a redirect.

My Public Key

You can download my key gpg_key.asc, from pgp.mit.edu, or cut/paste this below:

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.0.8 (GNU/Linux)

mQGiBEeJt0sRBADpPsQI9ektG1GW/eDtuS+yR9BeNLvkroR3nZLIEMEUi4pQ5JAi
lYWP7nWgQhfaMUKWsmpPV+OAXs9jDXpjWri8yNmRfW7eaNSdgH3CFH/re+UFovo8
B1Bg/aogDSeDDNQsry51jL3P1kZyrmUXw4rT9QkZ//zLe6XXuzQH5ryx6wCgrzRS
wcLI2Uadpd7+1um/f3NhssEEAJ1+aep7nOFVVGrRmBXt4vzsZwUL/xlHptvpY1Yh
ay+dKeLWO/b8xpD04dt7ktTMup3gFXhQd0XRfuzm8Hgyjke3X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IWkP/08sZxKDxnGoBd2BvUabj98O6iERxw42NFRCgF5LUFIgV5mK
sbOZZwX4YXh0/HcliNR5tLKwKpAUVTp1wcMgZaudy6kb4g/Oek0lFV8Mdd+MiE8E
GBECAA8FAkeJt0sCGwwFCQHhM4AACgkQ45V6I7CH+OIXtgCgqJrwcRdtZ7EvJyCI
FmryEGrdjWwAn2Kec2ErcHTZhksDF+vNMB8XdZzf
=2y9f
-----END PGP PUBLIC KEY BLOCK-----

The fingerprint can verify that the above key is correct

Key fingerprint = 4EFE D0F6 5191 CD61 CF18  4932 E395 7A23 B087 F8E2