$ gpg --list-secret-keys --keyid-format=long
sec rsa4096/0123456789ABCDEF 2020-12-22 [SC] [expired: 2021-12-22]
0123456789ABCDEF0123456789ABCDEF12345678
uid [ expired] hyrious <hyrious@outlook.com>
$ # ok, they key 0123456789ABCDEF has expired, let's edit it
$ gpg --edit-key 0123456789ABCDEF
gpg> expire
Changing expiration time for the primary key.
Please specify how long the key should be valid.
0 = key does not expire
<n> = key expires in n days
<n>w = key expires in n weeks
<n>m = key expires in n months
<n>y = key expires in n years
Key is valid for? (0) 1y
Key expires at Tue 12 Apr 2022 20:28:50 IST
Is this correct? (y/N) y
sec rsa4096/0123456789ABCDEF
created: 2021-01-29 expires: 2022-04-12 usage: SC
trust: ultimate validity: ultimate
ssb rsa4096/FEDCBA9876543210
created: 2021-01-29 expires: 2021-12-22 usage: E
[ultimate] (1). hyrious <hyrious@outlook.com>
# Note that the sub key is not updated too, let's update it
gpg> key 1
gpg> expire
# Answer the same like above
# Now save it!
gpg> save
$ # Export it and copy the public key to GitHub
$ gpg --armor --export 0123456789ABCDEF | pbcopy
$ # 1. Delete the old key on GitHub
$ # 2. Add a new key
Created
January 23, 2024 08:44
-
-
Save hyrious/4c50d6974b8590c4b71abf154534ad7a to your computer and use it in GitHub Desktop.
Renew expired GPG key
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment