Skip to content

Instantly share code, notes, and snippets.

@marcomalva
Created January 27, 2022 04:31
Show Gist options
  • Save marcomalva/ebc347ba699de951ed0e570e58a33de9 to your computer and use it in GitHub Desktop.
Save marcomalva/ebc347ba699de951ed0e570e58a33de9 to your computer and use it in GitHub Desktop.
[gpg snippets sheet]GPG snippets #gpg #decrypt
# see also:
# * to export public key: <https://mirrors.tripadvisor.com/centos-vault/4.5/docs/html/rhel-sbs-en-4/s1-gnupg-export.html>
# * to extract private key to another machine: <https://makandracards.com/makandra-orga/37763-gpg-extract-private-key-and-import-on-different-machine>
# * to check key expiration date: <https://stackoverflow.com/questions/48914338/how-to-get-expiration-date-from-a-gpg-key>
# * to encrypt/decrypt: <https://www.gnupg.org/gph/en/manual/x110.html>
#
# list public keys
gpg --list-keys
# export public key
gpg --armor --export "<email>" > /dev/shm/public-key.asc
# list secret key
gpg --list-secret-keys "<email>"
# export private key
gpg --export-secret-keys "<email>" > /dev/shm/private-key.key
# check for created/expiration date of public key
gpg --armor --export "<email>" | gpg --list-packets
gpg --armor --export "<email>" | gpg --list-packets | h "created|expire"
# decrypt file input.pgp and save as output.txt
gpg --output "ouput.txt" --decrypt "input.pgp"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment