buguno / gpg-cheatsheet

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

License:GNU General Public License v3.0


Languages

Language:Markdown 100.0%