draft-ietf-cbor-tags-oid-07.txt   draft-ietf-cbor-tags-oid-08.txt 
Network Working Group C. Bormann Network Working Group C. Bormann
Internet-Draft Universit├Ąt Bremen TZI Internet-Draft Universit├Ąt Bremen TZI
Intended status: Standards Track 19 May 2021 Intended status: Standards Track 21 May 2021
Expires: 20 November 2021 Expires: 22 November 2021
Concise Binary Object Representation (CBOR) Tags for Object Identifiers Concise Binary Object Representation (CBOR) Tags for Object Identifiers
draft-ietf-cbor-tags-oid-07 draft-ietf-cbor-tags-oid-08
Abstract Abstract
The Concise Binary Object Representation (CBOR, RFC 8949) is a data The Concise Binary Object Representation (CBOR, RFC 8949) is a data
format whose design goals include the possibility of extremely small format whose design goals include the possibility of extremely small
code size, fairly small message size, and extensibility without the code size, fairly small message size, and extensibility without the
need for version negotiation. need for version negotiation.
The present document defines CBOR tags for object identifiers (OIDs). The present document defines CBOR tags for object identifiers (OIDs).
It is intended as the reference document for the IANA registration of It is intended as the reference document for the IANA registration of
skipping to change at page 1, line 37 skipping to change at page 1, line 37
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at https://datatracker.ietf.org/drafts/current/. Drafts is at https://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on 20 November 2021. This Internet-Draft will expire on 22 November 2021.
Copyright Notice Copyright Notice
Copyright (c) 2021 IETF Trust and the persons identified as the Copyright (c) 2021 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents (https://trustee.ietf.org/ Provisions Relating to IETF Documents (https://trustee.ietf.org/
license-info) in effect on the date of publication of this document. license-info) in effect on the date of publication of this document.
Please review these documents carefully, as they describe your rights Please review these documents carefully, as they describe your rights
and restrictions with respect to this document. Code Components and restrictions with respect to this document. Code Components
extracted from this document must include Simplified BSD License text extracted from this document must include Simplified BSD License text
as described in Section 4.e of the Trust Legal Provisions and are as described in Section 4.e of the Trust Legal Provisions and are
provided without warranty as described in the Simplified BSD License. provided without warranty as described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3 1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3
2. Object Identifiers . . . . . . . . . . . . . . . . . . . . . 3 2. Object Identifiers . . . . . . . . . . . . . . . . . . . . . 4
2.1. Requirements on the byte string being tagged . . . . . . 5 2.1. Requirements on the byte string being tagged . . . . . . 5
2.2. Preferred Serialization Considerations . . . . . . . . . 6 2.2. Preferred Serialization Considerations . . . . . . . . . 6
2.3. Discussion . . . . . . . . . . . . . . . . . . . . . . . 6 2.3. Discussion . . . . . . . . . . . . . . . . . . . . . . . 6
3. Basic Examples . . . . . . . . . . . . . . . . . . . . . . . 6 3. Basic Examples . . . . . . . . . . . . . . . . . . . . . . . 7
3.1. Encoding of the SHA-256 OID . . . . . . . . . . . . . . . 6 3.1. Encoding of the SHA-256 OID . . . . . . . . . . . . . . . 7
3.2. Encoding of a MIB Relative OID . . . . . . . . . . . . . 7 3.2. Encoding of a MIB Relative OID . . . . . . . . . . . . . 7
4. Tag Factoring with Arrays and Maps . . . . . . . . . . . . . 8 4. Tag Factoring with Arrays and Maps . . . . . . . . . . . . . 8
4.1. Preferred Serialization Considerations . . . . . . . . . 8 4.1. Preferred Serialization Considerations . . . . . . . . . 8
4.2. Tag Factoring Example: X.500 Distinguished Name . . . . . 8 4.2. Tag Factoring Example: X.500 Distinguished Name . . . . . 9
5. CDDL Control Operators . . . . . . . . . . . . . . . . . . . 10 5. CDDL Control Operators . . . . . . . . . . . . . . . . . . . 10
6. CDDL typenames . . . . . . . . . . . . . . . . . . . . . . . 11 6. CDDL typenames . . . . . . . . . . . . . . . . . . . . . . . 11
7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 11 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 11
7.1. CBOR Tags . . . . . . . . . . . . . . . . . . . . . . . . 11 7.1. CBOR Tags . . . . . . . . . . . . . . . . . . . . . . . . 11
7.2. CDDL Control Operators . . . . . . . . . . . . . . . . . 12 7.2. CDDL Control Operators . . . . . . . . . . . . . . . . . 12
8. Security Considerations . . . . . . . . . . . . . . . . . . . 12 8. Security Considerations . . . . . . . . . . . . . . . . . . . 12
9. References . . . . . . . . . . . . . . . . . . . . . . . . . 13 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 13
9.1. Normative References . . . . . . . . . . . . . . . . . . 13 9.1. Normative References . . . . . . . . . . . . . . . . . . 13
9.2. Informative References . . . . . . . . . . . . . . . . . 14 9.2. Informative References . . . . . . . . . . . . . . . . . 14
Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 15 Appendix A. Change Log . . . . . . . . . . . . . . . . . . . . . 15
skipping to change at page 3, line 21 skipping to change at page 3, line 21
well as a tagging mechanism that enables extending the set of data well as a tagging mechanism that enables extending the set of data
types supported via an IANA registry. types supported via an IANA registry.
The present document defines CBOR tags for object identifiers (OIDs, The present document defines CBOR tags for object identifiers (OIDs,
[X.660]), which many IETF protocols carry. The ASN.1 Basic Encoding [X.660]), which many IETF protocols carry. The ASN.1 Basic Encoding
Rules (BER, [X.690]) specify binary encodings of both (absolute) Rules (BER, [X.690]) specify binary encodings of both (absolute)
object identifiers and relative object identifiers. The contents of object identifiers and relative object identifiers. The contents of
these encodings (the "value" part of BER's type-length-value these encodings (the "value" part of BER's type-length-value
structure) can be carried in a CBOR byte string. This document structure) can be carried in a CBOR byte string. This document
defines two CBOR tags that cover the two kinds of ASN.1 object defines two CBOR tags that cover the two kinds of ASN.1 object
identifiers encoded in this way. The tags can also be applied to identifiers encoded in this way, and a third one to enable a common
arrays and maps to efficiently tag all elements of an array or all optimization. The tags can also be applied to arrays and maps to
keys of a map. It is intended as the reference document for the IANA efficiently tag all elements of an array or all keys of a map. It is
registration of the tags so defined. intended as the reference document for the IANA registration of the
tags so defined.
1.1. Terminology 1.1. Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in "OPTIONAL" in this document are to be interpreted as described in
BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all
capitals, as shown here. capitals, as shown here.
The terminology of [RFC8949] applies; in particular the term "byte" The terminology of [RFC8949] applies; in particular the term "byte"
is used in its now customary sense as a synonym for "octet". The is used in its now customary sense as a synonym for "octet". The
term "SDNV" (Self-Delimiting Numeric Value) is used as defined in verb "to tag (something)" is used to express the construction of a
[RFC6256], with the additional restriction detailed in Section 2.1 CBOR tag with the object (something) as the tag content and a tag
(no leading zeros). number indicated elsewhere in the sentence (for instance in a "with"
clause, or by the shorthand "an NNN tag" for "a tag with tag number
NNN"). The term "SDNV" (Self-Delimiting Numeric Value) is used as
defined in [RFC6256], with the additional restriction detailed in
Section 2.1 (no leading zeros).
2. Object Identifiers 2. Object Identifiers
The International Object Identifier tree [X.660] is a hierarchically The International Object Identifier tree [X.660] is a hierarchically
managed space of identifiers, each of which is uniquely represented managed space of identifiers, each of which is uniquely represented
as a sequence of unsigned integer values [X.680]. (These integer as a sequence of unsigned integer values [X.680]. (These integer
values are called "primary integer values" in X.660 because they can values are called "primary integer values" in X.660 because they can
be accompanied by (not necessarily unambiguous) secondary be accompanied by (not necessarily unambiguous) secondary
identifiers. We ignore the latter and simply use the term "integer identifiers. We ignore the latter and simply use the term "integer
values" here, occasionally calling out their unsignedness. We also values" here, occasionally calling out their unsignedness. We also
skipping to change at page 4, line 40 skipping to change at page 5, line 5
The inverse transformation (again making use of the known ranges of X The inverse transformation (again making use of the known ranges of X
and Y) is applied when decoding the object identifier. and Y) is applied when decoding the object identifier.
Since the semantics of absolute and relative object identifiers Since the semantics of absolute and relative object identifiers
differ, and it is very common for companies to use self-assigned differ, and it is very common for companies to use self-assigned
numbers under the arc "1.3.6.1.4.1" (IANA Private Enterprise Number numbers under the arc "1.3.6.1.4.1" (IANA Private Enterprise Number
OID, [IANA.enterprise-numbers]) that adds 5 fixed bytes to an encoded OID, [IANA.enterprise-numbers]) that adds 5 fixed bytes to an encoded
OID value, this specification defines three tags, collectively called OID value, this specification defines three tags, collectively called
the "OID tags" here: the "OID tags" here:
Tag TBD111: tags a byte string as the [X.690] encoding of an absolute Tag number TBD111: used to tag a byte string as the [X.690] encoding
object identifier (simply "object identifier" or "OID"). of an absolute object identifier (simply "object identifier" or
"OID").
Tag TBD110: tags a byte string as the [X.690] encoding of a relative Tag number TBD110: used to tag a byte string as the [X.690] encoding
object identifier (also "relative OID"). Since the encoding of each of a relative object identifier (also "relative OID"). Since the
number is the same as for [RFC6256] Self-Delimiting Numeric Values encoding of each number is the same as for [RFC6256] Self-Delimiting
(SDNVs), this tag can also be used for tagging a byte string that Numeric Values (SDNVs), this tag can also be used for tagging a byte
contains a sequence of zero or more SDNVs (or a more application- string that contains a sequence of zero or more SDNVs (or a more
specific tag can be created for such an application). application-specific tag can be created for such an application).
Tag TBD112: structurally like TBD110, but understood to be relative Tag TBD112: structurally like TBD110, but understood to be relative
to "1.3.6.1.4.1" (IANA Private Enterprise Number OID, to "1.3.6.1.4.1" (IANA Private Enterprise Number OID,
[IANA.enterprise-numbers]). Hence, the semantics of the result are [IANA.enterprise-numbers]). Hence, the semantics of the result are
that of an absolute object identifier. that of an absolute object identifier.
2.1. Requirements on the byte string being tagged 2.1. Requirements on the byte string being tagged
To form a valid tag, a byte string tagged by TBD111, TBD110, or To form a valid tag, a byte string tagged with TBD111, TBD110, or
TBD112 MUST be syntactically valid contents (the value part) for a TBD112 MUST be syntactically valid contents (the value part) for a
BER representation of an object identifier (Sections 8.19, 8.20, and BER representation of an object identifier (Sections 8.19, 8.20, and
8.20 of [X.690], respectively): A concatenation of zero or more SDNV 8.20 of [X.690], respectively): A concatenation of zero or more SDNV
values, where each SDNV value is a sequence of one or more bytes that values, where each SDNV value is a sequence of one or more bytes that
all have their most significant bit set, except for the last byte, all have their most significant bit set, except for the last byte,
where it is unset. Also, the first byte of each SDNV cannot be a where it is unset. Also, the first byte of each SDNV cannot be a
leading zero in SDNV's base-128 arithmetic, so it cannot take the leading zero in SDNV's base-128 arithmetic, so it cannot take the
value 0x80 (bullet (c) in Section 8.1.2.4.2 of [X.690]). value 0x80 (bullet (c) in Section 8.1.2.4.2 of [X.690]).
In other words: In other words:
skipping to change at page 8, line 7 skipping to change at page 8, line 16
43 # 0b010_00011: mt 2 (bstr), 3 bytes 43 # 0b010_00011: mt 2 (bstr), 3 bytes
01 01 1D # X.690 Clause 8.20 01 01 1D # X.690 Clause 8.20
Figure 4: MIB relative object identifier, in CBOR Figure 4: MIB relative object identifier, in CBOR
This relative OID saves seven bytes compared to the full OID This relative OID saves seven bytes compared to the full OID
encoding. encoding.
4. Tag Factoring with Arrays and Maps 4. Tag Factoring with Arrays and Maps
OID tags can tag byte strings (as discussed above), but also CBOR The tag content of OID tags can be byte strings (as discussed above),
arrays and maps. The idea in the latter case is that the tag is but also CBOR arrays and maps. The idea in the latter case is that
factored out from each individual item in the container; the tag is the tag construct is factored out from each individual item in the
placed on the array or map instead. container; the tag is placed on the array or map instead.
When an OID tag is applied to an array, it means that the respective When the tag content of an OID tag is an array, this means that the
tag is imputed to all elements of the array that are byte strings, respective tag is imputed to all elements of the array that are byte
arrays, or maps. (There is no effect on other elements, including strings, arrays, or maps. (There is no effect on other elements,
text strings or tags.) For example, when an array is tagged with including text strings or tags.) For example, when the tag content
TBD111, every array element that is a byte string is an OID, and of a TBD111 tag is an array, every array element that is a byte
every element that is an array or map is in turn treated as discussed string is an OID, and every element that is an array or map is in
here. turn treated as discussed here.
When an OID tag is applied to a map, it means that the respective tag When the tag content of an OID tag is a map, this means that a tag
is imputed to all keys in the map that are byte strings, arrays, or with the same tag number is imputed to all keys in the map that are
maps; again, there is no effect on keys of other major types. Note byte strings, arrays, or maps; again, there is no effect on keys of
that there is also no effect on the values in the map. other major types. Note that there is also no effect on the values
in the map.
As a result of these rules, tag factoring in nested arrays and maps As a result of these rules, tag factoring in nested arrays and maps
is supported. For example, a 3-dimensional array of OIDs can be is supported. For example, a 3-dimensional array of OIDs can be
composed by using a single TBD111 tag containing an array of arrays composed by using a single TBD111 tag containing an array of arrays
of arrays of byte strings. All such byte strings are then considered of arrays of byte strings. All such byte strings are then considered
OIDs. OIDs.
4.1. Preferred Serialization Considerations 4.1. Preferred Serialization Considerations
Where tag factoring with tag TBD111 is used, some OIDs enclosed in Where tag factoring with tag number TBD111 is used, some OIDs
the tag may be encoded in a shorter way by using tag TBD112 instead enclosed in the tag may be encoded in a shorter way by using tag
of encoding an unadorned byte string. This remains the preferred number TBD112 instead of encoding an unadorned byte string. This
serialization (see also Section 2.2). However, this specification remains the preferred serialization (see also Section 2.2). However,
does not make the presence or absence of tag factoring a preferred this specification does not make the presence or absence of tag
serialization; application protocols can define where tag factoring factoring a preferred serialization; application protocols can define
is to be used or not (and will need to do so if they have where tag factoring is to be used or not (and will need to do so if
deterministic encoding requirements). they have deterministic encoding requirements).
4.2. Tag Factoring Example: X.500 Distinguished Name 4.2. Tag Factoring Example: X.500 Distinguished Name
Consider the X.500 distinguished name: Consider the X.500 distinguished name:
+==============================+=============+ +==============================+=============+
| Attribute Types | Attribute | | Attribute Types | Attribute |
| | Values | | | Values |
+==============================+=============+ +==============================+=============+
| c (2.5.4.6) | US | | c (2.5.4.6) | US |
skipping to change at page 11, line 49 skipping to change at page 11, line 49
roid = #6.110(bstr) roid = #6.110(bstr)
pen = #6.112(bstr) pen = #6.112(bstr)
Figure 9: Recommended typenames for CDDL Figure 9: Recommended typenames for CDDL
7. IANA Considerations 7. IANA Considerations
7.1. CBOR Tags 7.1. CBOR Tags
IANA is requested to assign in the 1+1 byte space (24..255) of the IANA is requested to assign in the 1+1 byte space (24..255) of the
CBOR tags registry [IANA.cbor-tags] the CBOR tags in Table 2, with CBOR tags registry [IANA.cbor-tags] the CBOR tag numbers in Table 2,
the present document as the specification reference. with the present document as the specification reference.
+========+================+============================+============+ +========+================+============================+============+
| Tag | Data Item | Semantics | Reference | | Tag | Data Item | Semantics | Reference |
+========+================+============================+============+ +========+================+============================+============+
| TBD111 | byte string | object identifier (BER | [this | | TBD111 | byte string | object identifier (BER | [this |
| | or array or | encoding) | document, | | | or array or | encoding) | document, |
| | map | | Section 2] | | | map | | Section 2] |
+--------+----------------+----------------------------+------------+ +--------+----------------+----------------------------+------------+
| TBD110 | byte string | relative object identifier | [this | | TBD110 | byte string | relative object identifier | [this |
| | or array or | (BER encoding); | document, | | | or array or | (BER encoding); | document, |
| | map | SDNV [RFC6256] sequence | Section 2] | | | map | SDNV [RFC6256] sequence | Section 2] |
+--------+----------------+----------------------------+------------+ +--------+----------------+----------------------------+------------+
| TBD112 | byte string | object identifier (BER | [this | | TBD112 | byte string | object identifier (BER | [this |
| | or array or | encoding), relative to | document, | | | or array or | encoding), relative to | document, |
| | map | 1.3.6.1.4.1 | Section 2] | | | map | 1.3.6.1.4.1 | Section 2] |
+--------+----------------+----------------------------+------------+ +--------+----------------+----------------------------+------------+
Table 2: Values for New Tags Table 2: New Tag Numbers
7.2. CDDL Control Operators 7.2. CDDL Control Operators
IANA is requested to assign in the CDDL Control Operators registry IANA is requested to assign in the CDDL Control Operators registry
[IANA.cddl] the CDDL Control Operators in Table 3, with the present [IANA.cddl] the CDDL Control Operators in Table 3, with the present
document as the specification reference. document as the specification reference.
+==========+============================+ +==========+============================+
| Name | Reference | | Name | Reference |
+==========+============================+ +==========+============================+
 End of changes. 17 change blocks. 
50 lines changed or deleted 57 lines changed or added

This html diff was produced by rfcdiff 1.48. The latest version is available from http://tools.ietf.org/tools/rfcdiff/