Private keys never expire. Only public keys do. Otherwise, the world would never notice the expiration as (hopefully) the world never sees the private keys.
For the important part, there is only one way, so that saves a discussion about pros and cons.
You have to extend the validity of the main key:
gpg --edit-key 0x12345678
gpg> expire
...
gpg> save
You have to make a decision about extending validity of vs. replacing the subkey(s). Replacing them gives you limited forward security (limited to rather large time frames). If that is important to you then you should have (separate) subkeys for both encryption and signing (the default is one for encryption only).
gpg --edit-key 0x12345678
gpg> key 1
gpg> expire
...
gpg> key 1
gpg> key 2
gpg> expire
...
gpg> save
You need key 1
twice for selecting and deselecting because you can extend the validity of only one key at a time.
You could also decide to extend the validity unless you have some reason to assume the key has been compromised. Not throwing the whole certificate away in case of compromise makes sense only if you have an offline main key (which IMHO is the only reasonable way to use OpenPGP anyway).
The users of your certificate have to get its updated version anyway (either for the new key signatures or for the new key(s)). Replacing makes the key a bit bigger but that is not a problem.
If you use smartcards (or plan to do so) then having more (encryption) keys creates a certain inconvenience (a card with the new key cannot decrypt old data).
expire
command actually walks you through setting the expiry time on a key, so perhaps you "renew" the key by just setting the expiry time further into the future? – Viktor Haag Jan 21 '18 at 16:41key *
) and set expiration for all. – Golar Ramblar Feb 11 '21 at 17:48key 0
key 1
because the numerotation begins at zero. – Sandburg Mar 05 '22 at 14:54ssb
) types with an expiration date? I do understand the reason behind that, but as far as I'm concerned those subkeys (ssb
) are secret subkeys...and it's possible to set an expiration date for them. – x80486 May 29 '22 at 01:36expire
? – Iizuki Aug 16 '23 at 05:55expire
(would seem odd to me to have different commands). – Hauke Laging Aug 19 '23 at 15:01