首页 > 解决方案 > gpg --with-colon returns ????-??-?? as the expiration date. Linux Y2K issue?

问题描述

The gpg --with-colon reports bad expiration date (although the key is usable for encryption) See "[expires: ????-??-??]"

gpg --with-colon key.ascii
pub:-:1024:17:77A54749D56561D6:2016-06-10:????-??-??::-:AAA AAA <AAA@somewhere.com>:
sub:-:2048:16:44479A86F9DB1538:2016-06-10:????-??-??::: [expires: ????-??-??]

When I run --list-packets I can see that the expiration is set to 27 years in future:

gpg --list-packets key.ascii
...
        hashed subpkt 2 len 4 (sig created 2016-06-10)
        hashed subpkt 9 len 4 (key expires after 27y145d0h0m)

Does it mean that gpg has a bug in handling 2016-06-10 + 27y145d?

Is it safe to assume that the date virtually never expires and assume it did not expire because the second column in the --with-colons argument is '-' and not 'e' (see https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=blob_plain;f=doc/DETAILS for the details of --with-colons output)

标签: gnupg

解决方案


实际上它是 Linux y2k 问题。即使在 Windows 版本的 gpg 上。看到这个:

gpg --gen-key
...
Key is valid for? (0) 50y
Key expires at ????-??-??
Your system can't display dates beyond 2038.
However, it will be correctly handled up to 2106.
Is this correct? (y/N)

是的。请注意,当您将到期时间设置为 2038之后,它将影响 gpg 显示到期日期以及任何依赖于 gpg 列出的正确到期日期的软件。

编辑:用于gpg --with-colon --fixed-list-mode将纪元时间打印为整数,您可以处理到 2106 年。


推荐阅读