Skip to content

buguno/gpg-cheatsheet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GPG cheat sheet

gpg is the OpenPGP part of the GNU Privacy Guard (GnuPG). It is a tool to provide digital encryption and signing services using the OpenPGP standard. gpg features complete key management and all the bells and whistles you would expect from a full OpenPGP implementation. The repository is for quick queries of the most used commands.

Summary

  1. ✨ Generate key
  2. 📋 List keys
  3. 🗑️ Delete key
  4. 🚫 Revoke key
  5. 📤 Export key
  6. 📥 Import key
  7. 🔏 Signatures
  8. 🔒 Encrypt
  9. 🔓 Decrypt

✨ Generate key

gpg --full-generate-key

📋 List keys

# List all keys
gpg --list-keys

# List secret keys
gpg --list-secret-keys

# List public keys
gpg --list-public-keys

# List the long form of the GPG keys for which you have both a public and private key.
gpg --list-secret-keys --keyid-format=long

# List all keys (or the specified ones) along with their fingerprints.
gpg --fingerprint

🗑️ Delete key

# Remove key from the public keyring.
gpg --delete-keys <ID>

# Remove key from the secret keyring.
gpg --delete-secret-keys <ID>

# Same as --delete-key, but if a secret key exists, it will be removed first.
gpg --delete-secret-and-public-key <ID>

🚫 Revoke key

# Generate a revocation certificate for the complete key.
gpg --output <OUTPUT FILE NAME> --gen-revoke <ID>

📤 Export key

# Export public key and save in a file
gpg --output <OUTPUT FILE NAME> --export --armor <ID>

# Export secret key and save in a file
gpg --output <OUTPUT FILE NAME> --export-secret-keys --armor <ID>

📥 Import key

# Import a key
gpg --import <FILE>

🔏 Signatures

# Sign data
gpg --sign <FILE>

# Make a cleartext signature
gpg --clear-sign <FILE>

# Sign data with a specific key
gpg --default-key <ID> --sign <FILE>

# Create a detached signature
gpg --detach-sign <FILE>

# Verify the signature
gpg --verify <FILE>

# or
gpg --verify <FILE>.sig <FILE>

🔒 Encrypt

# Encrypt symmetric
gpg --symmetric <FILE>

# Encrypt asymmetric
gpg --encrypt <FILE>

# Encrypt asymmetric and set the receiver
gpg --encrypt --recipient <RECEIVER ID> <FILE>

# Encrypt and sign
gpg --encrypt --sign <FILE>

🔓 Decrypt

# Decrypt file gpg
gpg --output <OUTPUT FILE NAME> --decrypt <FILE>.gpg

About

The repository is for quick queries of the most used commands.

Topics

Resources

License

Stars

Watchers

Forks