Skip to content

Instantly share code, notes, and snippets.

@nerg4l
Last active April 25, 2021 07:48
Show Gist options
  • Save nerg4l/db445f05ad9b44393d2e8df3e4872179 to your computer and use it in GitHub Desktop.
Save nerg4l/db445f05ad9b44393d2e8df3e4872179 to your computer and use it in GitHub Desktop.
GPG Cheat Sheet

This cheat sheet is for gpg2 which is aliased by the gpg command on Ubuntu.

Switch to Pinentry TTY

sudo apt install pinentry-tty
sudo update-alternatives --config pinentry

Source: https://superuser.com/a/1381147

Verify

gpg --verify <File Input>

--verify Assume that the first argument is a signed file or a detached signature and verify it without generating any output. [...]

Source: https://linux.die.net/man/1/gpg

Decrypt

gpg -d <File Input>

-d, --decrypt Decrypt the file given on the command line [...]

Source: https://linux.die.net/man/1/gpg

Use specific user as signer during encrypt or sign

gpg -u <Sender Name> command

-u, --local-user Use name as the key to sign with. [...]

Source: https://linux.die.net/man/1/gpg

Encrypt, Sign and output in ASCII

gpg -esa -r <Receiver Name> <File Input>

-e, --encrypt Encrypt data. This option may be combined with --sign [...]

-s, --sign Make a signature. This command may be combined with --encrypt [...]

-a, --armor Create ASCII armored output. [...]

-r, --recipient Encrypt for user id name. [...]

Source: https://linux.die.net/man/1/gpg

Create document with inline signature (clearsign)

gpg --clearsign <File Input>

--clearsign Make a clear text signature. [...]

Source: https://linux.die.net/man/1/gpg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment