draft-ietf-cbor-cddl-more-control-03.txt   draft-ietf-cbor-cddl-more-control-04.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 26 February 2024 Intended status: Standards Track 28 March 2024
Expires: 29 August 2024 Expires: 29 September 2024
More Control Operators for CDDL More Control Operators for CDDL
draft-ietf-cbor-cddl-more-control-03 draft-ietf-cbor-cddl-more-control-04
Abstract Abstract
The Concise Data Definition Language (CDDL), standardized in RFC The Concise Data Definition Language (CDDL), standardized in RFC
8610, provides "control operators" as its main language extension 8610, provides "control operators" as its main language extension
point. RFCs have added to this extension point both in an point. RFCs have added to this extension point both in an
application-specific and a more general way. application-specific and a more general way.
The present document defines a number of additional generally The present document defines a number of additional generally
applicable control operators for text conversion (Bytes, Integers, applicable control operators for text conversion (Bytes, Integers,
JSON, Printf-style formatting), operations on text, and deterministic JSON, Printf-style formatting) and for an operation on text.
encoding.
About This Document About This Document
This note is to be removed before publishing as an RFC. This note is to be removed before publishing as an RFC.
The latest revision of this draft can be found at https://cbor- The latest revision of this draft can be found at https://cbor-
wg.github.io/cddl-more-control/. Status information for this wg.github.io/cddl-more-control/. Status information for this
document may be found at https://datatracker.ietf.org/doc/draft-ietf- document may be found at https://datatracker.ietf.org/doc/draft-ietf-
cbor-cddl-more-control/. cbor-cddl-more-control/.
skipping to change at page 2, line 10 skipping to change at page 2, line 10
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 29 August 2024. This Internet-Draft will expire on 29 September 2024.
Copyright Notice Copyright Notice
Copyright (c) 2024 IETF Trust and the persons identified as the Copyright (c) 2024 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 Revised BSD License text as extracted from this document must include Revised BSD License text as
described in Section 4.e of the Trust Legal Provisions and are described in Section 4.e of the Trust Legal Provisions and are
provided without warranty as described in the Revised BSD License. provided without warranty as described in the Revised BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 4 1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3
2. Text Conversion . . . . . . . . . . . . . . . . . . . . . . . 4 2. Text Conversion . . . . . . . . . . . . . . . . . . . . . . . 4
2.1. Byte Strings: Base16 (Hex), Base32, Base45, Base64 . . . 4 2.1. Byte Strings: Base16 (Hex), Base32, Base45, Base64 . . . 4
2.2. Numbers . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.2. Numbers . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3. Printf-style Formatting . . . . . . . . . . . . . . . . . 6 2.3. Printf-style Formatting . . . . . . . . . . . . . . . . . 6
2.4. JSON Values . . . . . . . . . . . . . . . . . . . . . . . 7 2.4. JSON Values . . . . . . . . . . . . . . . . . . . . . . . 7
3. Text Processing . . . . . . . . . . . . . . . . . . . . . . . 8 3. Text Processing . . . . . . . . . . . . . . . . . . . . . . . 8
3.1. Join . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.1. Join . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4. Deterministic Encoding . . . . . . . . . . . . . . . . . . . 8 4. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 8
5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 9 5. Implementation Status . . . . . . . . . . . . . . . . . . . . 9
6. Implementation Status . . . . . . . . . . . . . . . . . . . . 10 6. Security considerations . . . . . . . . . . . . . . . . . . . 9
7. Security considerations . . . . . . . . . . . . . . . . . . . 11 7. References . . . . . . . . . . . . . . . . . . . . . . . . . 10
8. References . . . . . . . . . . . . . . . . . . . . . . . . . 11 7.1. Normative References . . . . . . . . . . . . . . . . . . 10
8.1. Normative References . . . . . . . . . . . . . . . . . . 11 7.2. Informative References . . . . . . . . . . . . . . . . . 11
8.2. Informative References . . . . . . . . . . . . . . . . . 12 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 11
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 12 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 12
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 13
1. Introduction 1. Introduction
The Concise Data Definition Language (CDDL), standardized in The Concise Data Definition Language (CDDL), standardized in
[RFC8610], provides "control operators" as its main language [RFC8610], provides "control operators" as its main language
extension point (Section 3.8 of [RFC8610]). RFCs have added to this extension point (Section 3.8 of [RFC8610]). RFCs have added to this
extension point both in an application-specific [RFC9090] and a more extension point both in an application-specific [RFC9090] and a more
general [RFC9165] way. general [RFC9165] way.
The present document defines a number of additional generally The present document defines a number of additional generally
skipping to change at page 3, line 42 skipping to change at page 3, line 34
| | numbers | | | numbers |
+---------------+---------------------------------------+ +---------------+---------------------------------------+
| .printf | Printf-formatted text representation | | .printf | Printf-formatted text representation |
| | of data items | | | of data items |
+---------------+---------------------------------------+ +---------------+---------------------------------------+
| .json | Text representation of JSON values | | .json | Text representation of JSON values |
+---------------+---------------------------------------+ +---------------+---------------------------------------+
| .join | Building text from array of | | .join | Building text from array of |
| | components | | | components |
+---------------+---------------------------------------+ +---------------+---------------------------------------+
| .cbordet, | deterministically encoded CBOR data |
| .cborseqdet | items, CBOR sequences |
+---------------+---------------------------------------+
Table 1: New control operators in this document Table 1: New control operators in this document
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 [BCP14] when, and only when, they appear in all capitals, as
capitals, as shown here. shown here.
Regular expressions mentioned in the text are as defined in Regular expressions mentioned in the text are as defined in
[RFC9485]. [RFC9485].
This specification uses terminology from [RFC8610]. In particular, This specification uses terminology from [RFC8610]. In particular,
with respect to control operators, "target" refers to the left-hand with respect to control operators, "target" refers to the left-hand
side operand, and "controller" to the right-hand side operand. side operand, and "controller" to the right-hand side operand.
"Tool" refers to tools along the lines of that described in "Tool" refers to tools along the lines of that described in
Appendix F of [RFC8610]. Note also that the data model underlying Appendix F of [RFC8610]. Note also that the data model underlying
CDDL provides for text strings as well as byte strings as two CDDL provides for text strings as well as byte strings as two
skipping to change at page 6, line 5 skipping to change at page 6, line 5
The additional designation "sloppy" indicates that the text string is The additional designation "sloppy" indicates that the text string is
not validated for any additional bits being zero, in variance to what not validated for any additional bits being zero, in variance to what
is specified in the paragraph behind table 1 in Section 4 of is specified in the paragraph behind table 1 in Section 4 of
[RFC4648]. Note that the present specification is opinionated again [RFC4648]. Note that the present specification is opinionated again
in not specifying a sloppy variant of base32 or base32/hex, as no in not specifying a sloppy variant of base32 or base32/hex, as no
legacy use of sloppy base32(/hex) was known at the time of writing. legacy use of sloppy base32(/hex) was known at the time of writing.
Base45 is known to be suboptimal for use in environments with limited Base45 is known to be suboptimal for use in environments with limited
data transparency (such as URLs), but is included because of its data transparency (such as URLs), but is included because of its
close relationship to QR codes and its wide use in health informatics close relationship to QR codes and its wide use in health informatics
(note that base45 is at least strongly specified not to allow sloppy (note that base45 is strongly specified not to allow sloppy forms of
forms of encoding). encoding).
2.2. Numbers 2.2. Numbers
+==========+=================+===========+ +==========+=================+===========+
| name | meaning | reference | | name | meaning | reference |
+==========+=================+===========+ +==========+=================+===========+
| .decimal | Decimal Integer | --- | | .decimal | Decimal Integer | --- |
+----------+-----------------+-----------+ +----------+-----------------+-----------+
Table 3: Control Operator for Text Table 3: Control Operator for Text
skipping to change at page 8, line 4 skipping to change at page 8, line 4
+=======+=========+===========+ +=======+=========+===========+
| .json | JSON | [STD90] | | .json | JSON | [STD90] |
+-------+---------+-----------+ +-------+---------+-----------+
Table 5: Control Operator Table 5: Control Operator
for Text Conversion of JSON for Text Conversion of JSON
values values
embedded-claims = text .json claims embedded-claims = text .json claims
claims = {iss: text, exp: text} claims = {iss: text, exp: text}
Note that a .jsonseq is not provided, as no use case is known yet. Note that a .jsonseq is not provided for [RFC7464], as no use case
for inclusion in CDDL is known yet.
There is no way to constrain the use of blank space in data items to There is no way to constrain the use of blank space in data items to
be validated; variants (e.g, not providing for any blank space) could be validated; variants (e.g, not providing for any blank space) could
be defined. be defined.
3. Text Processing 3. Text Processing
3.1. Join 3.1. Join
Often, text strings need to be constructed out of parts that can best Often, text strings need to be constructed out of parts that can best
be modeled as an array. be modeled as an array.
skipping to change at page 8, line 35 skipping to change at page 8, line 37
In general, this control operator is hard to validate as it would In general, this control operator is hard to validate as it would
require full parser functionality. It is therefore recommended to require full parser functionality. It is therefore recommended to
only use it in simple cases, and leave full parsing to ABNF (see only use it in simple cases, and leave full parsing to ABNF (see
Section 3 of [RFC9165]) or similar. Section 3 of [RFC9165]) or similar.
legacy-ip-address = text .join [bytetext, ".", bytetext, legacy-ip-address = text .join [bytetext, ".", bytetext,
".", bytetext, ".", bytetext] ".", bytetext, ".", bytetext]
bytetext = text .decimal byte bytetext = text .decimal byte
byte = 0..255 byte = 0..255
4. Deterministic Encoding 4. IANA Considerations
[RFC8610] and [RFC8742] specify the control operators .cbor and
.cborseq to indicate that the value of a byte string should be an
encoded CBOR data item or a CBOR sequence.
This specification provides complementary control operators .cbordet
and .cborseqdet that indicate that these data items/sequences need to
be encoded in accordance to Sections 4.2.1 and 4.2.2 of RFC 8949
[STD94].
+=============+=========================+===========+
| name | meaning | reference |
+=============+=========================+===========+
| .cbordet | deterministically | [RFC8610] |
| | encoded CBOR data item | |
+-------------+-------------------------+-----------+
| .cborseqdet | CBOR sequence made from | [RFC8742] |
| | deterministically | |
| | encoded CBOR data items | |
+-------------+-------------------------+-----------+
Table 7: Control Operator for Deterministically
Encoded Data Items and Sequences
Note that considerations of deterministic representation at the
application level can often be expressed in the CDDL definition of
the right-hand side and then do not need additional control
operators.
5. IANA Considerations
// RFC Editor: please replace RFC-XXXX with the RFC number of this // RFC Editor: please replace RFC-XXXX with the RFC number of this
// RFC and remove this note. // RFC and remove this note.
This document requests IANA to register the contents of Table 8 into This document requests IANA to register the contents of Table 7 into
the registry "CDDL Control Operators" of [IANA.cddl]: the registry "CDDL Control Operators" of [IANA.cddl]:
+==============+============+ +==============+============+
| Name | Reference | | Name | Reference |
+==============+============+ +==============+============+
| .b64u | [RFC-XXXX] | | .b64u | [RFC-XXXX] |
+--------------+------------+ +--------------+------------+
| .b64u-sloppy | [RFC-XXXX] | | .b64u-sloppy | [RFC-XXXX] |
+--------------+------------+ +--------------+------------+
| .b64c | [RFC-XXXX] | | .b64c | [RFC-XXXX] |
skipping to change at page 10, line 36 skipping to change at page 9, line 36
| .hexuc | [RFC-XXXX] | | .hexuc | [RFC-XXXX] |
+--------------+------------+ +--------------+------------+
| .decimal | [RFC-XXXX] | | .decimal | [RFC-XXXX] |
+--------------+------------+ +--------------+------------+
| .printf | [RFC-XXXX] | | .printf | [RFC-XXXX] |
+--------------+------------+ +--------------+------------+
| .json | [RFC-XXXX] | | .json | [RFC-XXXX] |
+--------------+------------+ +--------------+------------+
| .join | [RFC-XXXX] | | .join | [RFC-XXXX] |
+--------------+------------+ +--------------+------------+
| .cbordet | [RFC-XXXX] |
+--------------+------------+
| .cborseqdet | [RFC-XXXX] |
+--------------+------------+
Table 8: New control Table 7: New control
operators to be operators to be
registered registered
6. Implementation Status 5. Implementation Status
This section is to be removed before publishing as an RFC. This section is to be removed before publishing as an RFC.
In the CDDL tool described in Appendix F of [RFC8610], the control In the CDDL tool described in Appendix F of [RFC8610], the control
operators defined in the present revision of this specification are operators defined in the present revision of this specification are
implemented as of version 0.10.4. implemented as of version 0.10.4.
7. Security considerations 6. Security considerations
The security considerations of [RFC8610] apply. The security considerations of [RFC8610] apply.
8. References 7. References
8.1. Normative References 7.1. Normative References
[BCP14] Best Current Practice 14,
<https://www.rfc-editor.org/info/bcp14>.
At the time of writing, this BCP comprises the following:
Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119,
DOI 10.17487/RFC2119, March 1997,
<https://www.rfc-editor.org/info/rfc2119>.
Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
May 2017, <https://www.rfc-editor.org/info/rfc8174>.
[C] International Organization for Standardization, [C] International Organization for Standardization,
"Information technology — Programming languages — C", "Information technology — Programming languages — C",
Fourth Edition, ISO/IEC 9899:2018, June 2018, Fourth Edition, ISO/IEC 9899:2018, June 2018,
<https://www.iso.org/standard/74528.html>. Technically <https://www.iso.org/standard/74528.html>. Technically
equivalent specification text is available at equivalent specification text is available at
https://web.archive.org/web/20181230041359if_/ https://web.archive.org/web/20181230041359if_/
http://www.open- std.org/jtc1/sc22/wg14/www/abq/ http://www.open- std.org/jtc1/sc22/wg14/www/abq/
c17_updated_proposed_fdis.pdf c17_updated_proposed_fdis.pdf
(https://web.archive.org/web/20181230041359if_/ (https://web.archive.org/web/20181230041359if_/
http://www.open- std.org/jtc1/sc22/wg14/www/abq/ http://www.open- std.org/jtc1/sc22/wg14/www/abq/
c17_updated_proposed_fdis.pdf) c17_updated_proposed_fdis.pdf)
[IANA.cddl] [IANA.cddl]
IANA, "Concise Data Definition Language (CDDL)", IANA, "Concise Data Definition Language (CDDL)",
<https://www.iana.org/assignments/cddl>. <https://www.iana.org/assignments/cddl>.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", BCP 14, RFC 2119,
DOI 10.17487/RFC2119, March 1997,
<https://www.rfc-editor.org/rfc/rfc2119>.
[RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data
Encodings", RFC 4648, DOI 10.17487/RFC4648, October 2006, Encodings", RFC 4648, DOI 10.17487/RFC4648, October 2006,
<https://www.rfc-editor.org/rfc/rfc4648>. <https://www.rfc-editor.org/rfc/rfc4648>.
[RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
May 2017, <https://www.rfc-editor.org/rfc/rfc8174>.
[RFC8610] Birkholz, H., Vigano, C., and C. Bormann, "Concise Data [RFC8610] Birkholz, H., Vigano, C., and C. Bormann, "Concise Data
Definition Language (CDDL): A Notational Convention to Definition Language (CDDL): A Notational Convention to
Express Concise Binary Object Representation (CBOR) and Express Concise Binary Object Representation (CBOR) and
JSON Data Structures", RFC 8610, DOI 10.17487/RFC8610, JSON Data Structures", RFC 8610, DOI 10.17487/RFC8610,
June 2019, <https://www.rfc-editor.org/rfc/rfc8610>. June 2019, <https://www.rfc-editor.org/rfc/rfc8610>.
[RFC8742] Bormann, C., "Concise Binary Object Representation (CBOR)
Sequences", RFC 8742, DOI 10.17487/RFC8742, February 2020,
<https://www.rfc-editor.org/rfc/rfc8742>.
[RFC9165] Bormann, C., "Additional Control Operators for the Concise [RFC9165] Bormann, C., "Additional Control Operators for the Concise
Data Definition Language (CDDL)", RFC 9165, Data Definition Language (CDDL)", RFC 9165,
DOI 10.17487/RFC9165, December 2021, DOI 10.17487/RFC9165, December 2021,
<https://www.rfc-editor.org/rfc/rfc9165>. <https://www.rfc-editor.org/rfc/rfc9165>.
[RFC9285] Fältström, P., Ljunggren, F., and D.W. van Gulik, "The [RFC9285] Fältström, P., Ljunggren, F., and D.W. van Gulik, "The
Base45 Data Encoding", RFC 9285, DOI 10.17487/RFC9285, Base45 Data Encoding", RFC 9285, DOI 10.17487/RFC9285,
August 2022, <https://www.rfc-editor.org/rfc/rfc9285>. August 2022, <https://www.rfc-editor.org/rfc/rfc9285>.
[RFC9485] Bormann, C. and T. Bray, "I-Regexp: An Interoperable [RFC9485] Bormann, C. and T. Bray, "I-Regexp: An Interoperable
skipping to change at page 12, line 37 skipping to change at page 11, line 32
[STD94] Internet Standard 94, [STD94] Internet Standard 94,
<https://www.rfc-editor.org/info/std94>. <https://www.rfc-editor.org/info/std94>.
At the time of writing, this STD comprises the following: At the time of writing, this STD comprises the following:
Bormann, C. and P. Hoffman, "Concise Binary Object Bormann, C. and P. Hoffman, "Concise Binary Object
Representation (CBOR)", STD 94, RFC 8949, Representation (CBOR)", STD 94, RFC 8949,
DOI 10.17487/RFC8949, December 2020, DOI 10.17487/RFC8949, December 2020,
<https://www.rfc-editor.org/info/rfc8949>. <https://www.rfc-editor.org/info/rfc8949>.
8.2. Informative References 7.2. Informative References
[RFC7464] Williams, N., "JavaScript Object Notation (JSON) Text
Sequences", RFC 7464, DOI 10.17487/RFC7464, February 2015,
<https://www.rfc-editor.org/rfc/rfc7464>.
[RFC7951] Lhotka, L., "JSON Encoding of Data Modeled with YANG", [RFC7951] Lhotka, L., "JSON Encoding of Data Modeled with YANG",
RFC 7951, DOI 10.17487/RFC7951, August 2016, RFC 7951, DOI 10.17487/RFC7951, August 2016,
<https://www.rfc-editor.org/rfc/rfc7951>. <https://www.rfc-editor.org/rfc/rfc7951>.
[RFC9090] Bormann, C., "Concise Binary Object Representation (CBOR) [RFC9090] Bormann, C., "Concise Binary Object Representation (CBOR)
Tags for Object Identifiers", RFC 9090, Tags for Object Identifiers", RFC 9090,
DOI 10.17487/RFC9090, July 2021, DOI 10.17487/RFC9090, July 2021,
<https://www.rfc-editor.org/rfc/rfc9090>. <https://www.rfc-editor.org/rfc/rfc9090>.
 End of changes. 22 change blocks. 
80 lines changed or deleted 47 lines changed or added

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