0% found this document useful (0 votes)
2K views1 page

GPG Commands Cheatsheet

This document provides instructions for common GPG (GNU Privacy Guard) key and file management tasks like creating keys, listing keys, deleting keys, exporting and importing keys, encrypting and decrypting files, and interacting with key servers. The tasks covered include creating a key, listing private and public keys, deleting keys, exporting and importing keys to files, encrypting and decrypting files, generating revocation certificates, and sending and receiving keys from key servers.

Uploaded by

loldjdhrh233
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views1 page

GPG Commands Cheatsheet

This document provides instructions for common GPG (GNU Privacy Guard) key and file management tasks like creating keys, listing keys, deleting keys, exporting and importing keys, encrypting and decrypting files, and interacting with key servers. The tasks covered include creating a key, listing private and public keys, deleting keys, exporting and importing keys to files, encrypting and decrypting files, generating revocation certificates, and sending and receiving keys from key servers.

Uploaded by

loldjdhrh233
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
  • Create a Key
  • List Private Keys
  • Generate a Revocation Certificate
  • Delete a Public Key
  • Export a Private Key to File
  • Import a Public Key
  • Upload Your Key to a Keyserver
  • Encrypt Data

Create a key:

gpg --gen-key
You may either select the defaults (RSA and RSA with GPG2)
or use the more widespread DSA and Elgamal.
List private keys:
gpg --list-secret-keys
List public keys:
gpg --list-keys
Delete an private key:
gpg --delete-secret-key "username"
This deletes the secret key from your secret key ring.
Delete a public key:
gpg --delete-key "username"
Removes the public key associated with username from
your public key ring, but only if there is no associated private
key.
Export a private key into file:
gpg -a --export-secret-keys XXXXXXXXX | gpg
-aco [Link]
Creates a file called [Link] with the encrypted
and ASCII armored representation of the private key for the
entered ID (XXXXXXXXX).
Export a public key into file:
gpg -ao [Link] --export name@[Link]
Outputs your public key as an ASCII armored file publickey.
asc (replacing name@[Link] with the email address
for your key).
Import a private key:
gpg --allow-secret-key-import --import pri-
[Link]
Adds the private key in the file [Link] to your private
key ring.
GPG Cheatsheet
Import a public key:
gpg --import [Link]
Adds the public key in the file [Link] to your public key
ring.
Encrypt data:
gpg -e -u "sender username" -r "receiver username"
somefle
Options:
-u
Specifies the secret key to be used.
-r
Specifies the public key of the recipient.
Example:
gpg -e -u "yourname" -r "receivername" yourfle.
zip
Creates a file called [Link] that contains the en-
crypted data.
Decrypt data:
gpg -d [Link]
You will be asked to enter your passphrase.
Generate a revocation certificate:
gpg -ao [Link] --gen-revoke XXXXXXXX
Starts the process for creating a revocation certificate for the
entered ID (XXXXXXXX).
Send public key to a keyserver:
gpg --keyserver serverurl --send-keys XXXXXXXX
Sends a key with the ID XXXXXXXX to a keyserver with the
optional URL serverurl (for example hkp://[Link]-key-
[Link]).
Get public key from a keyserver:
gpg --keyserver serverurl --recv-key XXXXXXXX
Gets a key with the ID XXXXXXXX from a keyserver with the
URL serverurl (for example hkp://[Link]).
GPG Cheatsheet 1.0 | 2010-06-04 | [Link]

You might also like