Skip to content

Instantly share code, notes, and snippets.

@schneefisch
Last active February 17, 2026 10:44
Show Gist options
  • Select an option

  • Save schneefisch/c4269c299d5b650bdb2722d6439f742d to your computer and use it in GitHub Desktop.

Select an option

Save schneefisch/c4269c299d5b650bdb2722d6439f742d to your computer and use it in GitHub Desktop.
Basic GPG usage
#!/usr/bin/env bash
# Install
brew install gnupg
#Generate a key using:
gpg --full-generate-key
# Steps
# - Choose (9) ECC and ECC.
# - Select (1) Curve 25519.
# - Set validity (e.g., 2y or 0 for no expiration).
# - Enter your name, email, and an optional comment.
# - Set a strong passphrase.
# Curve25519 offers modern security and speed! 🌟
# encrypt file for specific key
gpg --output doc.gpg --encrypt --recipient blake@cyb.org doc
# encrypt with multiple recipients
gpg --output doc.gpg --encrypt --recipient blake@cyb.org --recipient bob@example.com doc
# decrypt file
gpg --output doc --decrypt doc.gpg
# list keys
gpg --list-keys
# Export keys
gpg --output <your.key>.gpg --armor --export 255F00609FFFCBA4AB14DC141701DEF2B7C7C6B6
gpg --output <your.key>.gpg --armor --export-secret-key 255F00609FFFCBA4AB14DC141701DEF2B7C7C6B6
# Import keys
gpg --import ~/mygpgkey_pub.gpg
gpg --allow-secret-key-import --import ~/mygpgkey_sec.gpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment