
GnuPG is a complete and free implementation of the OpenPGP standard encryption.
Installing GPG
GPG is available in Windows and many distributions of Linux, including a graphical user interface (GUI) that is easy to use. However, I prefer using the command line tools instead.
Red Hat / CentOS
sudo yum install gnupgUbuntu / Debian
sudo apt-get install gnupgNote: Use gpg2 (version 2.x)
Mac OS X
GPG is best installed on MacOS using Homebrew. Once Homebrew is installed, install GPG.
brew install gnupgGPG version
Check the version of the command line tools you are running or have installed
gpg --versionGPG Keys
Creating GPG keys
Generate your own GPG key pair which will be used to encrypt and decrypt files.
gpg --gen-keyExporting public keys
Your public key is the one that you can share to whom ever you will receive your message from. In other words, other other person will use your public key to encrypt their message when they send to you. You will be able to decrypt that message using your private key.
gpg --export --armor user@gmail.com > pubkey.ascExporting secret keys
Keep your private key in a safe place and never share it with anyone.
gpg --export-secret-keys --armor user@gmail.com > secretkey.ascImporting keys
You can import others' public key or another private key
gpg --import publickey.ascListing public keys
gpg --list-keysListing secret keys
gpg --list-secret-keys
Encrypting a file
gpg -r "Name" -e secretfile.txtEncrypting multiple files
gpg -r "Name" --encrypt-files $(ls $DIR/secretfile*.txt)Decrypt a file to disk
gpg secretfile.txt.gpgDeleting public keys
gpg --delete-key [key-ID]Deleting secret keys
gpg --delete-secret-key [key-ID]
 
Add new comment