Gnupg notes

Created at 2024-12-08 20:19
Last edited at 2025-04-21 12:20

Reload the agent after a version update

Resolves the “gpg-agent is older than us” warning.

gpgconf --kill all

Generate a new key

gpg --full-gen-key
gpg --list-keys
/home/user/.gnupg/pubring.kbx
-------------------------------------------
pub   rsa3072 2022-08-24 [SC]
      3B45F6I8F73C872F57B227F1232F1A65AC6F5044
uid           [ultimate] user <user@somedomain>
sub   rsa3072 2022-08-24 [E]

Key ID: 3B45F6I8F73C872F57B227F1232F1A65AC6F5044

Export your private key

gpg --armor --export-secret-keys '<keyid>' > gpg-private-key.asc

Renew an expired key

gpg --list-keys
gpg --edit-key '<keyid>'

Set new expiration date for the primary key (key 0)

gpg> expire

Select sub-keys and set new expiration date for them

gpg> key 1
gpg> key 2
gpg> expire

Make sure the keys are trusted after the edits

gpg> trust

Save

gpg> save