erwah / ietf

CBOR Web Token
0 stars 2 forks source link

Use numeric date instead of major type 6, minor type 1. #1

Closed erwah closed 8 years ago

erwah commented 8 years ago

I would strongly suggest consideration of the CBOR type of numeric date rather than the string version (Major type 6, minor type 1). This will lead to a much more compact form of date encoding in most if not all cases.

Mail from Jim Schaad.

selfissued commented 8 years ago

Quoting from https://tools.ietf.org/html/rfc7049#section-2.4.1:

Tag value 1 is for numerical representation of seconds relative to 1970-01-01T00:00Z in UTC time. (For the non-negative values that the Portable Operating System Interface (POSIX) defines, the number of seconds is counted in the same way as for POSIX "seconds since the epoch" [TIME_T].) The tagged item can be a positive or negative integer (major types 0 and 1), or a floating-point number (major type 7 with additional information 25, 26, or 27). Note that the number can be negative (time before 1970-01-01T00:00Z) and, if a floating- point number, indicate fractional seconds.

It seems like what we should actually do is specify that tag 1 be used within major type 6, minor type 1. Then we'd be using numeric dates.

selfissued commented 8 years ago

Reading this more closely, Type6NumericDate already specifies CBOR major type 6, with tag value 1, which is a numeric date. No change is required.