Skip to main content

GnuPG and it's use

·171 words·1 min·
Linux PGP Gnupg Blog PGP
Table of Contents

Date: 29th October, 2023

About and instalation of GPG (GNU Privacy Guard)
#

GPG (GNU Privacy Guard) is a complete and free implementation of the OpenPGP standard.

URL: https://www.gnupg.org/

On Archlinux using yay: yay -S core/gnupg


Encryption / Decryprion
#

Encrypt file or folder (compress the folder) (Self Encrypt):

gpg --encrypt --recipient self@self.com folfer-or-file.tar.gz

Encrypt for multiple people to decrypt:

gpg --encrypt --recipient notself@notself.com --recipient someone@example.com xyz.txt

Decrypt to terminal:

gpg  --decrypt snap.xyz.gpg

Decrypt to file:

gpg --output snap_dec2 --decrypt snap.tar.gz.

Export Keys
#

Export public key:

gpg --export --armor self@self.com > pubkey.asc

Export Private key:

gpg --export-secret-keys --armor self@self.com > privkey.asc

tar the keys:

tar -czvf gpg_folder.tar.gz gpg_folder

backup in cloud.

to import these keys on a new device or secure server:

gpg --import pubkey.asc
gpg --import privkey.asc

next, trust keys:

gpg --edit-key self@self.com
	trust
	5
	quit

Encrypt Passwords using pass
#

About Pass: Stores, retrieves, generates, and synchronizes passwords securely

yay -S extra/pass
pass init username@email.com
pass insert outlook

Generate complex passwords: pass generate genrate-example 30

pass insert work/company1/email