GPG in Fedora 36 (Quickstart Guide)

This article describes the process of encrypting and decrypting files with GnuPG (GPG) using asymmetric cryptography (public key and private key).

This is specially useful when you want to make sure (ideally) that only the intended receiver can see the message, needless to say that you are able to sign any messages as well.

Installation

dnf install gnupg

Key Generation

gpg --full-generate-key

File Encryption

Single File

gpg --encrypt --output myFileName.ext.gpg --recipient some@email.com myFileName.ext

Multiple Files

tar cvz ./ | gpg --encrypt --output all.tgz.gpg --recipient some@email.com

File Decryption

Single File

gpg --decrypt --output myFileName.ext myFileName.ext.gpg

Multiple Files

gpg --decrypt all.tgz.gpg | tar xzv

Input files will not be deleted after encryption / decryption when using this methods, you need to do that manually.

More information: https://gnupg.org/documentation/manpage.html