Skip to content

Latest commit

 

History

History
113 lines (72 loc) · 1.71 KB

GPG_Cheatsheet.md

File metadata and controls

113 lines (72 loc) · 1.71 KB

GPG Cheatsheet 🔐

Key Management 🔑

  • Generate a new GPG key pair:
gpg --full-generate-key
  • List all keys in your GPG keyring:
gpg --list-keys
  • List all the secret keys in your GPG keyring:
gpg --list-secret-keys

Message Encryption and Decryption 💌

  • Encrypt a message:
gpg -e -u "[email protected]" -r "[email protected]" message.txt

This creates message.txt.gpg.

  • Decrypt a message:
gpg -o decrypted-message.txt -d message.txt.gpg

This creates decrypted-message.txt.

GPG Folder Encryption Cheat Sheet 📂

Encrypting a Folder 🔒

  1. Create a tarball from the folder you want to encrypt:
tar -czvf archive.tar.gz /path/to/folder_to_encrypt
  1. Encrypt the tarball using GPG:
gpg -e -r [email protected] archive.tar.gz

Decrypting a Folder 🔓

  1. Decrypt the GPG file to a tarball:
gpg -o archive.tar.gz -d archive.tar.gz.gpg
  1. Extract the tarball to the original folder:
tar -xzvf archive.tar.gz

Encrypting a message for yourself: [Different Method] 🤔

  1. Generate a Key Pair:
gpg --gen-key
  1. Encrypt the Message:
gpg -e -u "Your Name" -r "Your Name" message.txt
  1. Decrypt the Message:
gpg -d message.txt.gpg

Encrypting a message for someone else: 🤝

  1. Import Their Public Key:
gpg --import theirkey.gpg
  1. Encrypt the Message:
gpg -e -u "Your Name" -r "Their Name" message.txt

Exporting & Importing Keys 📤📥

  1. Exporting Your Public Key:
gpg --list-keys
gpg --export -a "Your Name" > public.key