Re: [openpgp] time representation in OpenPGP

Werner Koch <wk@gnupg.org> Tue, 05 July 2016 08:17 UTC

Return-Path: <wk@gnupg.org>
X-Original-To: openpgp@ietfa.amsl.com
Delivered-To: openpgp@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 70F3E12D169 for <openpgp@ietfa.amsl.com>; Tue, 5 Jul 2016 01:17:03 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -5.386
X-Spam-Level:
X-Spam-Status: No, score=-5.386 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, URIBL_RHS_DOB=1.514] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SkwO0xLzgaCg for <openpgp@ietfa.amsl.com>; Tue, 5 Jul 2016 01:17:02 -0700 (PDT)
Received: from kerckhoffs.g10code.com (kerckhoffs.g10code.com [IPv6:2001:aa8:fff1:100::22]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id C58FF12D149 for <openpgp@ietf.org>; Tue, 5 Jul 2016 01:17:01 -0700 (PDT)
Received: from uucp by kerckhoffs.g10code.com with local-rmail (Exim 4.80 #2 (Debian)) id 1bKLXQ-0001GC-5R for <openpgp@ietf.org>; Tue, 05 Jul 2016 10:17:00 +0200
Received: from wk by wheatstone.g10code.de with local (Exim 4.84 #3 (Debian)) id 1bKLSi-0001VI-SZ; Tue, 05 Jul 2016 10:12:08 +0200
From: Werner Koch <wk@gnupg.org>
To: "Salz, Rich" <rsalz@akamai.com>
References: <87d1muyh70.fsf@alice.fifthhorseman.net> <fd725ea87a9141d0883831900e072f1f@usma1ex-dag1mb1.msg.corp.akamai.com>
Organisation: g10 Code GmbH
X-message-flag: Mails containing HTML will not be read! Please send only plain text.
OpenPGP: url=https://k.gnupg.net/80615870F5BAD690333686D0F2AD85AC1E42B367
Mail-Followup-To: "Salz\, Rich" <rsalz@akamai.com>, Daniel Kahn Gillmor <dkg@fifthhorseman.net>, IETF OpenPGP <openpgp@ietf.org>
Date: Tue, 05 Jul 2016 10:12:08 +0200
In-Reply-To: <fd725ea87a9141d0883831900e072f1f@usma1ex-dag1mb1.msg.corp.akamai.com> (Rich Salz's message of "Sun, 3 Jul 2016 13:48:44 +0000")
Message-ID: <87poqs5wrr.fsf@wheatstone.g10code.de>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Archived-At: <https://mailarchive.ietf.org/arch/msg/openpgp/BniGcZxHn37i_h4hBcAKISLpAvY>
Cc: IETF OpenPGP <openpgp@ietf.org>, Daniel Kahn Gillmor <dkg@fifthhorseman.net>
Subject: Re: [openpgp] time representation in OpenPGP
X-BeenThere: openpgp@ietf.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: "Ongoing discussion of OpenPGP issues." <openpgp.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/openpgp>, <mailto:openpgp-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/openpgp/>
List-Post: <mailto:openpgp@ietf.org>
List-Help: <mailto:openpgp-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/openpgp>, <mailto:openpgp-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 05 Jul 2016 08:17:03 -0000

On Sun,  3 Jul 2016 15:48, rsalz@akamai.com said:

> Isn't that the classic Unix time_t, which expires in 2038?

Only with 32 bit signed time_t.  The C standard declares time_t as
implementation defined and thus it can also be an unsigned 32 bit int or
64 bit.  The only requirement is that (time_t)(-1) is used as an error
return value.

> I suggest we use ASN1 generalized time (which has only a couple of
> bytes overhead) or ISO 8601 profiled to be like the ASN1 format:
> YYYY-MM-DD-HH:MM:SS.sss with fraction optional.

Due to real world problems, I use the compact 8601 representation ot
time for GnuPG's X.509 part: "20160704T100951" makes a nice 16 bytes
buffer (with the string terminator) and can be easily printed.  However,
using a buffer is not very convenient compared to a scalar like time_t.
And you need to write a lot of code for basic operations (consider a
wrong encoded string).

That does not mean, I would suggest to use such a string in OpenPGP
which has been designed as a compact binary protocol.


Salam-Shalom,

   Werner


-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.
 /* Join us at OpenPGP.conf  <https://openpgp-conf.org> */