13

In GnuPG I can edit the expiry of my key like this:

$ gpg --edit-key 01234567
[...]

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)

But what if I want to set the expiry to a specific (absolute) date/time, e.g. 01-01-2015, midnight? Do I really have to calculate the exact time from now, e.g. 9m+15d+...?

1 Answer 1

11

The output of GnuPG on how to specify the expiry is missing the option to just enter an ISO date in the form of YYYY-MM-DD. Unlike the help text suggests it would not be valid, it will just work:

Key is valid for? (0) 2015-01-01
Key expires at Thu 01 Jan 2015 00:00:00 CET
3
  • 3
    It doesn’t accept 2038-01-01T00:00:00Z but 20380101T000000Z, for what it’s worth. Jun 23, 2019 at 5:25
  • ...And this way it won’t set the Key Expiration Time (0x9) subpacket value minute-level-accurately. Mine have differences of a few minutes. Jun 23, 2019 at 10:02
  • 1
    @КонстантинВан, this seems to be resolved at least as of gpg (GnuPG/MacGPG2) 2.2.24.
    – Jivan Pal
    Jan 3, 2021 at 21:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.