Page MenuHome GnuPG

Kleopatra: Displayed S/MIME certificate expiration date capped at 2038
Open, HighPublic

Description

On vsd-3.3.4 @ win10 S/MIME certificates with an expiration date > 2038 will be displayed as 01.01.2038:

On gpg4win-5.0.0 @ win11 this is fine:

To reproduce:
you can use those S/MIME certificates:



gpgsm -k

[...]

           ID: 0x082C4AFE
          S/N: 04
        (dec): 4
       Issuer: /CN=CA/OU=QA/O=g10code/L=Erkrath/ST=NRW/C=DE/EMail=ca@gnupg.test
      Subject: /CN=Bob/O=QA/L=Erkrath/ST=NRW/C=DE/EMail=bob@gnupg.test
     validity: 2026-02-05 12:05:17 through 2066-01-26 12:05:17
     key type: rsa4096
    key usage: digitalSignature nonRepudiation
  fingerprint: 46:25:E9:2A:9D:99:6E:9E:D0:F2:CC:2C:B8:81:9A:BF:08:2C:4A:FE
     sha2 fpr: E5:C2:18:CD:00:1A:F8:9A:D7:14:09:0E:FE:A4:0F:33:1C:B2:6B:0A:8C:E5:35:B6:92:A4:F0:11:EE:01:A9:78

           ID: 0xF498F1C2
          S/N: 0A
        (dec): 10
       Issuer: /CN=CA/OU=QA/O=g10code/L=Erkrath/ST=NRW/C=DE/EMail=ca@gnupg.test
      Subject: /CN=Bob/O=QA/L=Erkrath/ST=NRW/C=DE/EMail=bob@gnupg.test
     validity: 2026-02-05 12:05:23 through 2066-01-26 12:05:23
     key type: rsa4096
    key usage: keyEncipherment dataEncipherment
  fingerprint: 9D:6C:11:43:D0:44:CB:73:17:6C:00:67:1C:2C:77:6C:F4:98:F1:C2
     sha2 fpr: 90:6E:9A:C9:71:11:21:7B:28:4C:FA:66:C7:F6:D7:D2:3B:34:05:A5:1C:42:D7:5D:1C:F5:68:13:F5:3E:2E:81

           ID: 0x15E8BCA0
          S/N: 6EA0F536FA9F254E9D5ACC8FC2DCC7BC786FBD62
        (dec): 631578465240821673183783924282725369712355556706
       Issuer: /CN=CA/OU=QA/O=g10code/L=Erkrath/ST=NRW/C=DE/EMail=ca@gnupg.test
      Subject: /CN=CA/OU=QA/O=g10code/L=Erkrath/ST=NRW/C=DE/EMail=ca@gnupg.test
     validity: 2026-02-05 12:05:15 through 2048-01-31 12:05:15
     key type: rsa4096
    key usage: certSign crlSign
 chain length: unlimited
  fingerprint: 9E:32:7B:1A:7A:30:0B:FB:C5:16:0D:F2:AA:79:2B:3C:15:E8:BC:A0
     sha2 fpr: C9:62:0B:77:22:ED:DF:BC:D8:FC:FF:A5:03:8A:50:B9:64:2B:EC:48:F0:21:B4:A2:AD:C2:C9:8A:EC:CE:B9:74

gpgsm -k --with-colon

[...]
crt::4096:1:B8819ABF082C4AFE:20260205T120517:20660126T120517:04::1.2.840.113549.1.9.1=#636140676E7570672E74657374,CN=CA,OU=QA,O=g10code,L=Erkrath,ST=NRW,C=DE::sS::::::23:
fpr:::::::::4625E92A9D996E9ED0F2CC2CB8819ABF082C4AFE:::9E327B1A7A300BFBC5160DF2AA792B3C15E8BCA0:
fp2:::::::::E5C218CD001AF89AD714090EFEA40F331CB26B0A8CE535B692A4F011EE01A978::::
grp:::::::::73AEE39FF839448BF28158A49806638B20FBECFF:
uid:::::::::CN=Bob,1.2.840.113549.1.9.1=#626F6240676E7570672E74657374,O=QA,L=Erkrath,ST=NRW,C=DE::
uid:::::::::<bob@gnupg.test>::
crt::4096:1:1C2C776CF498F1C2:20260205T120523:20660126T120523:0A::1.2.840.113549.1.9.1=#636140676E7570672E74657374,CN=CA,OU=QA,O=g10code,L=Erkrath,ST=NRW,C=DE::eE::::::23:
fpr:::::::::9D6C1143D044CB73176C00671C2C776CF498F1C2:::9E327B1A7A300BFBC5160DF2AA792B3C15E8BCA0:
fp2:::::::::906E9AC97111217B284CFA66C7F6D7D23B3405A51C42D75D1CF56813F53E2E81::::
grp:::::::::2F02EA90681775F0D5F8C78593F9588497AA2C87:
uid:::::::::CN=Bob,1.2.840.113549.1.9.1=#626F6240676E7570672E74657374,O=QA,L=Erkrath,ST=NRW,C=DE::
uid:::::::::<bob@gnupg.test>::
crt:u:4096:1:AA792B3C15E8BCA0:20260205T120515:20480131T120515:6EA0F536FA9F254E9D5ACC8FC2DCC7BC786FBD62::1.2.840.113549.1.9.1=#636140676E7570672E74657374,CN=CA,OU=QA,O=g10code,L=Erkrath,ST=NRW,C=DE::cC::::::23:
fpr:::::::::9E327B1A7A300BFBC5160DF2AA792B3C15E8BCA0:::9E327B1A7A300BFBC5160DF2AA792B3C15E8BCA0:
fp2:::::::::C9620B7722EDDFBCD8FCFFA5038A50B9642BEC48F021B4A2ADC2C98AECCEB974::::
grp:::::::::F79307A2ADB9A432BD26FE4FC444A5472515E6E4:
uid:u::::::::1.2.840.113549.1.9.1=#636140676E7570672E74657374,CN=CA,OU=QA,O=g10code,L=Erkrath,ST=NRW,C=DE::
uid:u::::::::<ca@gnupg.test>::

gpgme.log

Details

Version
vsd-3.3.4 @ win10

Event Timeline

timegrid created this object with edit policy "Contributor (Project)".

The capping of the date seems to be caused by this workaround/hack in gpgme's _gpgme_parse_timestamp

/* Fixme: We would better use a configure test to see whether
   mktime can handle dates beyond 2038. */
if (sizeof (time_t) <= 4 && year >= 2038)
  return (time_t)2145914603; /* 2037-12-31 23:23:23 */

Since 2010 on Windows SystemTimeToFileTime is used instead of mktime so that this workaround might be superfluous even for 32-bit builds on Windows.

I have verified (by locally applying the change to a Gpg4win 4 build) that ifdef'ing-out the above hack for Windows builds fixes the display issue.

@werner: Shall we backport the fix to the gpgme-1.24-branch or do we just add a patch to gpg4win's gpg4win-4-branch and/or vsd-3.3-branch?

ebo triaged this task as High priority.Fri, Feb 6, 10:10 AM