Skip to content

Instantly share code, notes, and snippets.

@Rovel
Last active October 28, 2022 19:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rovel/a5f168491c70e98b07fb0eda9645b771 to your computer and use it in GitHub Desktop.
Save Rovel/a5f168491c70e98b07fb0eda9645b771 to your computer and use it in GitHub Desktop.
GPG Commands

Generate your keys

Prereqs

Create your keys with your email.

Execute following commands:

Create your keys

gpg --full-generate-key

Export your keys

gpg --output ./my_pub_key.pub --armor --export email@example.com

Import your dev friends keys

gpg --import ~/my_friend.pub

Sign a message

gpg --encrypt --sign --armor -r first.recipient@example.com -r second.recipient@example.com  ./path_to_file

or

gpg -o ./encrypted_output_file --symmetric --cipher-algo AES256 ./file_to_encrypt

Decrypt a message

gpg my_secret_message.asc

Decrypt multifiles

Deal with multifiles: encrypt: ls | gpg --multifile --encrypt or ls | gpg --encrypt-files -r <recipient>

decrypt: ls | gpg --multifile --decrypt or ls | gpg --decrypt-files

for more info gpg cheat sheet

Renew expired keys

  • List keys to find expired gpg --list-keys
  • Get id and edit gpg --edit-key $KEY_ID
  • In gpg edit list your keys list
  • Select Keys key 1 or key 0
  • Renew key expire
  • Save and exit save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment