Thursday, January 2, 2025

Updating your expired GPG keys

 If you ever need to update your expired gpg keys, it's not terrible. First thing to do is to figure out which key you're working with, use

$> gpg --list-keys


Which should show you something like this

-----------------------------

pub   rsa3072 2020-12-29 [SC] [expired: 2024-12-31]

      09CF4ABCD7487EF21E9AFC859B4CE836EAAF3E31

uid   [ expired] Russell Simpkins <russellsimpkins@gmail.com>


Then you can edit the key using the ID

$> gpg --edit-key 09CF4ABCD7487EF21E9AFC859B4CE836EAAF3E31

gpg (GnuPG) 2.2.19; Copyright (C) 2019 Free Software Foundation, Inc.

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.

Secret key is available.

sec  rsa3072/9B4CE836EAAF3E31

     created: 2020-12-29  expires: 2026-01-02  usage: SC

     trust: ultimate      validity: ultimate

ssb  rsa3072/CC533814855BD92B

     created: 2020-12-29  expired: 2024-12-31  usage: E

[ultimate] (1). Russell Simpkins <russellsimpkins@gmail.com>


To change or update the expiration time, type the following

$> expire


It will prompt you to choose, I like to update mine yearly but you can pick whatever option you want. If you have a sub key like I do, then you will want to update that as well. Just pick the key using the following command

$> key 1

gpg> key 1

sec  rsa3072/9B4CE836EAAF3E31

     created: 2020-12-29  expires: 2026-01-02  usage: SC

     trust: ultimate      validity: ultimate

ssb* rsa3072/CC533814855BD92B

     created: 2020-12-29  expired: 2024-12-31  usage: E

[ultimate] (1). Russell Simpkins <russellsimpkins@gmail.com>


Notice that ssb has an asterisks next to it, that's how you know you're editing the sub key. Follow the same and type "expire" to set it's expiration date. That's it. Type "quit" to exit.

No comments: