In my project, we want to test how our product behaves when the GPG key expires. So we want the key to expire in a really short time in order to repeat the test frequently.
Actually, the prompt message when generating the key clearly indicates that the minimal unit of expiration is "day":
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
But I still want to ask the question out just in case there is something that meets my need: Is it possible to set GPG key expiration time shorter than one day (say, an hour, or even minutes)?
If there is no such a way, I'll need to figure out how to repeat our test without having to wait for a whole day.
As far as I can tell, it is only documented in the source code, but you can just enter the datetime at the Key is valid for? (0) prompt using the form yyyymmddThhmmss.
For example, to set the expiry to 8 March 2099 at 9:34 AM (UTC), you would enter 20990308T093400. The time zone of your input is always interpreted as UTC, although you will see the confirmation in your local time zone, e.g. Key expires at Fri Mar 8 10:34:00 2099 +01.
As of version 2.1.20, you can also append a Z to the datetime to explicitly denote UTC, e.g. 20190308T093400 Z, but no other time zones are supported for entry.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With