How to Encrypt and Decrpt files with GPG

Hi folks,

Today I write about an easy way to encrypt and decrypt files using GPG. GPG (also called GnuPG) is an acronym for GNU Privacy Guard. It is a free software replacement for Symantec’s PGP cryptographic software suite. It is a popular encryption software that supports several algorithms, including RSA, DSA, IDEA, etc. [1].

So, first, install GPG if you don’t already have it.

On a Mac run the command:

brew install gpg

Next, encrypt your file using the command, assuming you want to use AES-256 algorithm:

gpg --output <file name> --symmetric --cipher-algo AES256 <unencrypted file name>

You will be asked for a password which will be required for decryption.

To decrypt the file, use the following command:

gpg --decrypt <file name>

Again you will be asked for the password. Use the same one you provided during encryption.

Sources

  1. GNU Privacy Guard – Wikipedia, the free encyclopedia. https://en.wikipedia.org/wiki/GNU_Privacy_Guard

Leave a Reply

Your email address will not be published. Required fields are marked *