Skip to content

Instantly share code, notes, and snippets.

@morkin1792
Last active January 19, 2026 08:50
Show Gist options
  • Select an option

  • Save morkin1792/48844e913d5348968ca5bb6a22924892 to your computer and use it in GitHub Desktop.

Select an option

Save morkin1792/48844e913d5348968ca5bb6a22924892 to your computer and use it in GitHub Desktop.
gpg quick start

creating gpg key pair

gpg --full-generate-key

exporting public key

gpg --export --armor email@email > key.asc

importing public key

gpg --import pub.asc

listing public keys

gpg --list-public-keys

asymmetric encryption (using a public key)

# or -e        -r
gpg --encrypt --recipient friend@email file
 cat message.txt | gpg --encrypt --recipient email@email | base64 -w0 && echo

symmetric encryption (using a password)

# or -c
gpg --symmetric file
 cat message.txt | gpg --symmetric | base64 -w0 && echo

decrypting

# or -d
gpg --decrypt file.gpg > file
cat secret.txt | base64 -d | gpg -d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment