gpg

Table of Contents

1. gpg

1.1. Creating and Managing a GPG Key Pair - YouTube

mkdir /tmp/gnupg
chmod 700 /tmp/gnupg
export GNUPGHOME=/tmp/gnupg
gpg --list-keys # creates pubring.kbx trustdb.gpg
gpg --list-keys # lists no key
gpg --full-generate-key
gpg --edit-key # interactive session
# Commands can also be passed like this:
gpg --edit-key julian@example.com list key 0 expire
# save at the end to save to disk the changes
# I don't know how to revoke importing from openpgp-revocs.d, generate this way:
gpg --output revoke.asc --gen-revoke <key email>
gpg --import revoke.asc

# Encrypt/Decrypt
gpg --encrypt --recipient julian@example.com test
gpg --decrypt --recipient julian@example.com test.gpg

1.1.1. Types of keys

https://unix.stackexchange.com/questions/31996/how-are-the-gpg-usage-flags-defined-in-the-key-details-listing
Different keys are used for different pursposes
By default, it creates both SC and E keys
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Constant Character
───────────────────────────────
PUBKEY_USAGE_SIG S
PUBKEY_USAGE_CERT C
PUBKEY_USAGE_ENC E
PUBKEY_USAGE_AUTH A
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

1.2. Make GPG prompt for a password instead of failing

export GPG_TTY=$(tty) # Without this line, signed commits error out

1.4. Key expiration

Author: Julian Lopez Carballal

Created: 2024-10-21 Mon 09:11