rfc-8943

Concise Binary Object Representation (CBOR) Tags for Date

M. Jones, A. Nadalin, J. Richter
date2020-11 streamIETF areaart wgcbor statusPROPOSED STANDARD pages6 canonicalhttps://www.rfc-editor.org/rfc/rfc8943 doi10.17487/RFC8943
The Concise Binary Object Representation (CBOR), as specified in RFC 7049, is a data format whose design goals include the possibility of extremely small code size, fairly small message size, and extensibility without the need for version negotiation. In CBOR, one point of extensibility is the definition of CBOR tags. RFC 7049 defines two tags for time: CBOR tag 0 (date/time string as per RFC 3339) and tag 1 (POSIX "seconds since the epoch"). Since then, additional requirements have become known. This specification defines a CBOR tag for a date text string (as per RFC 3339) for applications needing a textual date representation within the Gregorian calendar without a time. It also defines a CBOR tag for days since the date 1970-01-01 in the Gregorian calendar for applications needing a numeric date representation without a time. This specification is the reference document for IANA registration of the CBOR tags defined.

Extracted elements (16)

design-rationale §1

Tag 100's integer value has a constant offset from the Modified Julian Date (MJD): it equals the MJD minus 40587. This relationship is noted as an implementation aid but MJD is not part of the tag's normative definition.

cbor

design-rationale §1.1

The day of the week is not explicitly represented in either date format. Deterministic algorithms can derive it from both formats, but such derivation is out of scope for this specification.

cbor

design-rationale §1.1

The epoch 1970-01-01 chosen for tag 100 is related to the POSIX time epoch only in that both contain that date. It must not be construed as indicating that dates using this tag represent a specific time of day or time zone.

cbor

design-rationale §1

Times of day, time zones, and leap seconds are explicitly not applicable to either tag, because both tags are for date-only representations. This is a deliberate design choice separating date from datetime semantics.

cbor

interoperability-note §1.2

Dates in tag 1004 'full-date' format can be compared by normal lexicographic string comparison because digits are in fixed format ordered from most to least significant. Numeric dates in tag 100 format can be compared by normal integer comparison.

cbor

interoperability-note §1.2

Different dates may correspond to the same moment in time depending on the time zone in which the date was determined (e.g., Japan's Friday may simultaneously be Hawaii's Thursday). Comparing dates with date/time values is out of scope for this specification.

cbor

interoperability-note §1

This specification extends RFC 7049 CBOR tag space, which already defines tag 0 (RFC 3339 date/time string) and tag 1 (POSIX seconds since epoch). Tags 1004 and 100 address the distinct need for date-only (no time) representations not covered by those existing tags.

cbor

normative-requirement §1 MUST

The text string tagged with tag 1004 MUST be represented as specified by the RFC 3339 'full-date' production, representing a date within the Gregorian calendar.

cbor

protocol-element §1

CBOR tag 100 (ASCII 'd') is defined for an unsigned or negative integer representing the number of days since the Gregorian calendar date 1970-01-01. Negative values represent dates before the epoch.

cbor

protocol-element §1

CBOR tag 1004 is defined for a UTF-8 text string representing a calendar date without a time, formatted as an RFC 3339 'full-date' string (e.g., '1940-10-09'). This tag enables textual Gregorian calendar date representation in CBOR data items.

cbor, json

registry §2.1

Two entries are registered in the IANA 'Concise Binary Object Representation (CBOR) Tags' registry: tag 1004 (UTF-8 text string; RFC 3339 full-date string) and tag 100 (unsigned or negative integer; number of days since epoch date 1970-01-01).

cbor, registry

security-consideration §3

Calendar dates do not represent a specific point in time, so using a date for access control decisions can produce different results depending on where the decision is made (e.g., a person may have reached their 21st birthday in Japan while still being a day short in Hawaii).

security, cbor

security-consideration §3

It is inappropriate to use only a date to trigger certificate expiration, since a calendar date corresponds to a range of times worldwide rather than a specific, geography-independent point in time.

security, pkix, cbor

security-consideration §3

The security considerations of RFC 7049 (CBOR) apply to these tags. Additional risks arise from exploitation of date ambiguities where dates are security-relevant or used in access control decisions.

security, cbor

wire-format §2.1

Tag 100 wraps an unsigned or negative integer data item. The integer encodes days since 1970-01-01; for example, October 9, 1940 is -10676 and December 8, 1980 is 3994.

cbor

wire-format §2.1

Tag 1004 wraps a UTF-8 text string data item. The string MUST conform to the RFC 3339 'full-date' production (YYYY-MM-DD), encoding a Gregorian calendar date with no time or timezone component.

cbor