Permanent link to this page

Registration information

   Tag             21607 (cbor-tag)
   Data Item       unsigned integer
   Semantics       a CBOR Tag identifier
   Reference       https://cbor.is4.site/cbor-tag
   Contact         IS4 <is4.site@gmail.com>

Summary

This tag indicates that its content is a CBOR Tag number.

Rationale

Some CBOR Tags impose particular restrictions on the structure of the tag content or indicate a unique interpretation of the tagged value, i.e. what one might consider lexical and value spaces for traditional text-based datatypes. In contexts where arbitrary CBOR values are expected to be produced or consumed, it might be beneficial to be able to refer to a particular CBOR Tag by its number to indicate one of those spaces or other properties of the CBOR Tag.

Description

The cbor-tag tag (value 21607) is followed by an unsigned integer (major type 0). The tag identifies a particular CBOR Tag using its tag number as recorded in the IANA CBOR Tags registry.

There are no restrictions on the range of allowed unsigned integers – a decoder that encounters a tag number not assigned to any existing tag MUST treat it equivalently to encountering a valid but contextually unsupported tag.

The particular interpretation of this tag is left to the application or protocol that uses it. For example, a service or client may use it in a content negotiation mechanism to indicate the range of supported datatypes (alongside other types of identifiers), it may be used in the description of a CBOR value without exposing the value itself, or it may be used to indicate a conversion to a value in the space associated with the tag using a non-standard mechanism.

Examples

The following value identifies the rational number tag (value 30):

21607(30)
D9 5467  # tag(21607)
   18 1E # unsigned(30)

An application MAY choose to use it in conjunction with other tags to indicate the construction of a value with a particular type, such as using the generic serialized object (value 27) tag:

27([21607(30), 1.25])
D8 1B          # tag(27)
   82          # array(2)
      D9 5467  # tag(21607)
         18 1E # unsigned(30)
      F9 3D00  # primitive(15616)

This could request the construction of a rational number equal in value to 1.25, such as by outputting 5/4 as if encoded directly:

30([5, 4])
D8 1E    # tag(30)
   82    # array(2)
      05 # unsigned(5)
      04 # unsigned(4)

Security considerations

When this tag is used for construction of values in a manner specific to the CBOR Tag it identifies, the same security considerations as those for the concrete CBOR Tag apply.