ILWC What is loading Privacy Statement About ILWC
Registreer
124
Extend expiration date of a gpg subkey
martijn
gpg privacy
2018-10-15 13:06:41
2018-10-15 14:00:00
2018-11-15 14:00:00
Today I tried to encrypt a file. But...I got an error-message:
[martijn@tijnie ~]$ gpg --encrypt -r a.m.bos@hhs.nl ww
gpg: a.m.bos@hhs.nl: skipped: unusable public key
gpg: ww: encryption failed: unusable public key
[martijn@tijnie ~]$
Well..uhhhh..ok ... not a problem... I probably just need to extend the expiration date of the key.

Show me the keys I know then(I left some keys ou of the below list):
[martijn@tijnie ~]$ gpg --list-keys
/home/martijn/.gnupg/pubring.gpg
--------------------------------
pub   2048R/3309F797 2016-04-06 [expires: 2019-01-13]
uid                  Martijn Bos (Martijn Bos op de Haagse Hogeschool) 
uid                  Martijn Bos (Martijn Bos op de Haagse Hogeschool) 
uid                  Martijn Bos (Martijn Bos op de Haagse Hogeschool) 

pub   2048R/7464C96F 2013-11-06
uid                  Martijn Bos (Pipesmoking Idiot) 
sub   2048R/B6CC410F 2013-11-06

...
...
...

pub   2048R/6CB307FE 2017-03-04 [expired: 2018-03-06]
uid                  Fu Bar (Fubar) 
The key I use at the office is 3309F797. But...I don't see it expired.
Let's have a closer look:
[martijn@tijnie ~]$ gpg --edit 3309F797
gpg (GnuPG) 1.4.23; Copyright (C) 2015 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.

pub  2048R/3309F797  created: 2016-04-06  expires: 2019-01-13  usage: SC  
                     trust: ultimate      validity: ultimate
sub  2048R/23720AC0  created: 2016-04-06  expired: 2018-04-11  usage: E   
[ultimate] (1). Martijn Bos (Martijn Bos op de Haagse Hogeschool) 
[ultimate] (2)  Martijn Bos (Martijn Bos op de Haagse Hogeschool) 
[ultimate] (3)  Martijn Bos (Martijn Bos op de Haagse Hogeschool) 

gpg>
Ah...there you have it... it expired a while ago (expired: 2018-04-11). But it's under a subkey (23720AC0)
OK...then I'll try to extend the expiration of the subkey:
[martijn@tijnie ~]$ gpg --edit-key 23720AC0
gpg (GnuPG) 1.4.23; Copyright (C) 2015 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.

pub  2048R/3309F797  created: 2016-04-06  expires: 2019-01-13  usage: SC  
                     trust: ultimate      validity: ultimate
sub  2048R/23720AC0  created: 2016-04-06  expired: 2018-04-11  usage: E   
[ultimate] (1). Martijn Bos (Martijn Bos op de Haagse Hogeschool) 
[ultimate] (2)  Martijn Bos (Martijn Bos op de Haagse Hogeschool) 
[ultimate] (3)  Martijn Bos (Martijn Bos op de Haagse Hogeschool) 

gpg> key 1 <--a bit redundant...since there is only one subkey

pub  2048R/3309F797  created: 2016-04-06  expires: 2019-01-13  usage: SC  
                     trust: ultimate      validity: ultimate
sub* 2048R/23720AC0  created: 2016-04-06  expired: 2018-04-11  usage: E   
[ultimate] (1). Martijn Bos (Martijn Bos op de Haagse Hogeschool) 
[ultimate] (2)  Martijn Bos (Martijn Bos op de Haagse Hogeschool) 
[ultimate] (3)  Martijn Bos (Martijn Bos op de Haagse Hogeschool) 

gpg> expire <--expand the expiry
Changing expiration time for a subkey.
Please specify how long the key should be valid.
         0 = key does not expire
        = key expires in n days
      w = key expires in n weeks
      m = key expires in n months
      y = key expires in n years
Key is valid for? (0) 3m <-- Expand it for 3 months
Key expires at Sun Jan 13 10:40:28 2019 CET
Is this correct? (y/N) y <-- Yes...this that's correct

You need a passphrase to unlock the secret key for
user: "Martijn Bos (Martijn Bos op de Haagse Hogeschool) " <-- Key in the password
2048-bit RSA key, ID 3309F797, created 2016-04-06

                  
pub  2048R/3309F797  created: 2016-04-06  expires: 2019-01-13  usage: SC  
                     trust: ultimate      validity: ultimate
sub* 2048R/23720AC0  created: 2016-04-06  expires: 2019-01-13  usage: E   
[ultimate] (1). Martijn Bos (Martijn Bos op de Haagse Hogeschool) 
[ultimate] (2)  Martijn Bos (Martijn Bos op de Haagse Hogeschool) 
[ultimate] (3)  Martijn Bos (Martijn Bos op de Haagse Hogeschool) 

gpg> save <-- Save this new configuration
[martijn@tijnie ~]$
As you can see now the expiration date changed to 2019-01-13
Mission accomplished

Don't forget to send your keys to your favourite key-server....
[martijn@tijnie ~]$ gpg --send-keys 3309F797 
gpg: sending key 3309F797 to hkp server keys.gnupg.net
[martijn@tijnie ~]$ gpg --send-keys 23720AC0
gpg: sending key 3309F797 to hkp server keys.gnupg.net
[martijn@tijnie ~]$