Skip to content

Instantly share code, notes, and snippets.

@mwatts272
Last active December 22, 2015 16:09
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 mwatts272/6497530 to your computer and use it in GitHub Desktop.
Save mwatts272/6497530 to your computer and use it in GitHub Desktop.
A collection of the most commonly used GnuPG Commands.
###########################
##### Generating Keys #####
###########################
## Generate a key. Follow the options and your good to go. Just make sure your on your Jack Jones!
gpg --gen-key
###############################
##### Importing your keys #####
###############################
## Import a friends key.
gpg --import pete-public.asc
## Search for Pete's key on the public name server.
gpg --search-keys 'pete@fbi.gov' --keyserver hkp://subkeys.pgp.net
###############################
##### Exporting your keys #####
###############################
## Export your public key.
gpg --export -a 'Matthew Watts' > /tmp/public-main.key
## Export your private key.
gpg --export-secret-key -a "Matthew Watts" > /tmp/private-core.key
##############################
##### Deleting your keys #####
##############################
## Delete your public key.
gpg --delete-key "Matthew Watts"
## Delete your private key.
gpg --delete-secret-key "Matthew Watts"
##############################
##### Remote key storage #####
##############################
## Store your keys on the key server.
gpg --send-keys 'Matthew Watts' --keyserver hkp://subkeys.pgp.net
############################
##### Encrypting Files #####
############################
## Encrypt a file.
gpg --encrypt --recipient 'Matthew Watts' /tmp/abovetopsecret.txt
## Encrypt a file with a symmetric cipher.
gpg --output /tmp/abovetopsecret.txt.gpg --symmetric /tmp/abovetopsecret.txt
############################
##### Decrypting Files #####
############################
## Decrypt a file.
gpg --output /tmp/abovetopsecret.decrytped.txt --decrypt /tmp/abovetopsecret.txt.gpg
################################
##### Verification Process #####
################################
## Verify a file for authenticity.
gpg --verify abovetopsecret.txt.gpg.asc abovetopsecret.txt.gpg
## Sign a file for verification.
gpg --armor --detach-sign your-file.zip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment