How to change expiration date of GPG subkey


Changing the expiration date for a subkey in your GPG (GNU Privacy Guard) keypair can be done using the gpg --edit-key command. Please keep in mind that you'll need to have the private key for the subkey to make changes to its expiration date. 

Steps:

Open a terminal or command prompt.

1) Start the key editing session by running:


gpg --edit-key your_key_id

2) Replace your_key_id with the ID or fingerprint of your keypair.

List your subkeys by typing:


list

This command will display a list of subkeys associated with your keypair.

3) Select the subkey you want to modify by typing:


key 1

Replace 1 with the number that corresponds to the subkey you want to edit, based on the list from the previous step.
First key would be 0, then 1, then 2..

4) Set the expiration date for the subkey. You can do this by using the expire command:


expire

5) You will be prompted to enter a new expiration date for the subkey. You can set the expiration date in a relative format (e.g., "+1y" for one year from today) or an absolute date (e.g., "2024-12-31"). Enter the desired expiration date.

After setting the new expiration date, save your changes by typing:


save

You may be prompted to enter your passphrase to save the changes. This step is essential to confirm your authorization to modify the key.

6) To confirm that the expiration date has been updated, you can list the key's details by running:


list

This will display the updated expiration date for the subkey.







If you like please follow and comment