GPG
GPG is an implementation of the OpenPGP standard (the term ‘PGP’ is trademarked by Symantec).
The best practice, that GPG implements by default, is to create a signing-only primary key with an encryption subkey1. These subkeys expire2 and must be extended or replaced from time to time.
The Basics
The basics of gpg can be broken down into:
- managing your keys
- encrypting and decrypting your files
- integrating gpg keys with mail and other utilities
Let’s skip the details of asymmetric key encryption, public private keys, and just know that there are two keys; your private key, and your public key. You encrypt with the public key, and you decrypt with the private key.
The private key is the one that matters. That’s the one you use to decrypt things. Your public key you can recreate, should you lose it, as long as you have your private key.
The public key is the one you pass out to your friends and even put on your web site when you want someone to sen you something that only you can read. It sounds crazy, but through wonders of mathematics, it can only be used to encrypt a file, never to decrypt one. So it doesn’t matter who you give it to. They can encrypt something, send it to you, and you can decrypt it - all without anyone sending a password.
You can also sign things. This is when you want to send something that anyone can read, but just want to be sure it came from you. More on that later. Let’s focus on secrecy.
Note - In my opinion, we can probably skip all the old command line stuff, not that it’s not good to know, it’s just slower to use as a novice.
http://ubuntuforums.org/showthread.php?t=680292
Key Management
To list keys
# If you don't use this list-option arguement, you won't see all the subkeys
gpg --list-options show-unusable-subkeys --list-keys
gpg --edit-key C621C2A8040C51F5C4AD9D2990A1676C9CB79C5D addkey
Encrypt and Decrypt
This will encrypt the file and apply the default option of appending .gpg on the end of the file
gpg -e -r '[email protected]' /path/to/some/file.txt
This will do the reverse - note you have to specify the output file or you will get to view the decrypted file via stdout, probably not what you wanted
gpg -o /path/to/some/file.txt -d /path/to/some/file.txt.gpg
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.