By: Darrell Brogdon Viewed: 1415 times Printer Friendly Format
GnuPG is strictly a command-line utility. There are several GUI wrappers to GPG but the binary is usually required. Since its core purpose is to encrypt and decrypt information, we're first going to have a look at doing just that, using GPG.
As with most Unix-based command-line utilities you first call the
gpgcommand followed by switches that affect the output of the utility. For example, to encrypt a file called "my_secret_data.txt" you would call GnuPG with the
-ecommand to encrypt followed by the
-r NAMEto tell GnuPG who should be able to decrypt the file. "NAME" in this instance is the first name or email address of the person who will be receiving the encrypted file. (Note that the user indicated by NAME must be in your public key ring and can be obtained by typing
Here it is in action:
$ gpg -e -r firstname.lastname@example.org my_secret_file.txt
this is done you will a file called 'my_secret_file.txt.gpg' in your current
directory. Any attempts to view the contents of this file will prove futile
unless you encrypted it using your own Public Key. Feeling like a secret agent
Now suppose Mr. John Doe has encrypted a file and sent it to you. To decrypt it you simply use the
followed by the encrypted file.
$ gpg -d john_doe_secret_file.txt.gpg
Since you have your private key contained within your secret key ring GnuPG can determine whom 'john_doe_secret_file.txt.gpg' was intended for and will decrypt it after you provide your passphrase.
Most Viewed Articles (in Trends )
Latest Articles (in Trends)
Comment on this tutorial
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews