Last active
February 17, 2026 10:44
-
-
Save schneefisch/c4269c299d5b650bdb2722d6439f742d to your computer and use it in GitHub Desktop.
Basic GPG usage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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