gnupg - 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)
解决方案
实际上它是 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 年。
推荐阅读
- reactjs - Apollo Client 3 将反应变量重置为其初始值
- python - 除了员工考勤表上的错误外,如何修复尝试?
- python - 自动点检测
- c# - 有没有一种方法可以访问 appsettings.json 配置而不需要类中的构造函数我试图从中访问它
- javascript - 在 React 中如何确定事件所附加的元素?
- python - 将 3D 三角剖分曲面展开为平面 2D 图
- c - 使用 uint64_t 的不便之处
- mysql - 如何使用 substr 对我的字符串列进行排序并在 mysql 中进行强制转换
- javascript - 在 PHP 中我使用 htmlspecialchars_decode,javascript 中的等价物是什么?
- html - 三个图像居中,并排,位于页面中间