Skip to content

Instantly share code, notes, and snippets.

@morkin1792
Last active September 1, 2023 01:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save morkin1792/48844e913d5348968ca5bb6a22924892 to your computer and use it in GitHub Desktop.
Save morkin1792/48844e913d5348968ca5bb6a22924892 to your computer and use it in GitHub Desktop.
gpg examples

create gpg key pair

gpg --full-generate-key

export public key

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

import public key

gpg --import pub.asc

list public keys

gpg --list-public-keys

encrypt asymmetric (with key)

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

encrypt symmetric (with password)

# or -c
gpg --symmetric file
 echo message | gpg --symmetric | base64 -w0

decrypt

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