RFC 9338: STD 96: CBOR Object Signing and Encryption (COSE): Countersignatures
- J. Schaad
Abstract
Concise Binary Object Representation (CBOR) is a data format designed for small code size and small message size.
CBOR Object Signing and Encryption (COSE) defines a set of security services for CBOR.
This document defines a countersignatur
Status of This Memo
This is an Internet Standards Track document.¶
This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 7841.¶
Information about the current status of this document, any
errata, and how to provide feedback on it may be obtained at
https://
Copyright Notice
Copyright (c) 2022 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
(https://
1. Introduction
There has been an increased focus on small, constrained devices that make up the Internet of Things (IoT).
One of the standards that has come out of this process is "Concise Binary Object Representation (CBOR)" [RFC8949].
CBOR extended the data model of the JavaScript Object Notation (JSON) [STD90] by allowing for binary data, among other changes.
CBOR has been adopted by several of the IETF working groups dealing with the IoT world as their method of encoding data structures.
CBOR was designed specifically to be small in terms of both messages transported and implementation size and to have a schema-free decoder.
A need exists to provide message security services for IoT, and using CBOR as the message
A countersignatur
The problem with the previous countersignatur
The new algorithm defined in this document is designed to produce the same countersignatur
With the publication of this document, implementers are encouraged to migrate uses of the previous countersignatur
1.1. Requirements Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.¶
1.2. CBOR Grammar
CBOR grammar in this document uses the Concise Data Definition Language (CDDL) [RFC8610].¶
The collected CDDL can be extracted from the XML version of this document via the XPath expression below. (Depending on the XPath evaluator one is using, it may be necessary to deal with > as an entity.)¶
CDDL expects the initial non-terminal symbol to be the first symbol in the file. For this reason, the first fragment of CDDL is presented here.¶
The non-terminal Internal_Types is defined for dealing with the automated validation tools used during the writing of this document. It references those non-terminals that are used for security computations but are not emitted for transport.¶
1.3. Document Terminology
In this document, we use the following terminology.¶
"Byte" is a synonym for "octet".¶
The Constrained Application Protocol (CoAP) is a specialized web transfer protocol for use in constrained systems. It is defined in [RFC7252].¶
"Context" is used throughout this document to represent information that is not part of the COSE message.
Information that is part of the context can come from different sources, including protocol interactions, associated key structures, and application configuration.
The context to use can be implicit, identified using either the "kid context" header parameter defined in [RFC8613] or a protocol
The term "byte string" is used for sequences of bytes, while the term "text string" is used for sequences of characters.¶
2. Countersignature Header Parameters
This section defines a set of common header parameters. A summary of these header parameters can be found in Table 1. This table should be consulted to determine the value of the label and the type of the value.¶
The set of header parameters defined in this section is:¶
- V2 countersignatur
e : -
This header parameter holds one or more countersignatur
e values. Countersignatur es provide a method of having a second party sign some data. The countersignatur e header parameter can occur as an unprotected attribute in any of the following structures that are defined in [RFC9052]: COSE_Sign1, COSE_Signature, COSE_Encrypt, COSE_recipient, COSE_Encrypt0, COSE_Mac, and COSE_Mac0. Details of version 2 countersignatur es are found in Section 3.¶
The CDDL fragment that represents the set of header parameters defined in this section is given below. Each of the header parameters is tagged as optional because they do not need to be in every map; however, the header parameters required in specific maps are discussed above.¶
3. Version 2 Countersignatures
A countersignatur
COSE supports two different forms for countersignatur
The version 2 countersignatur
COSE was designed for uniformity in how the data structures are specified.
One result of this is that for COSE one can expand the concept of countersignatur
3.1. Full Countersignatures
The COSE
The full countersignatur
The details of the fields of a countersignatur
An example of a countersignatur
It should be noted that only a signature algorithm with appendix (see Section 8.1 of [RFC9052]) can be used for countersignatur
3.2. Abbreviated Countersignatures
Abbreviated countersignatur
The CDDL fragment for the abbreviated countersignatur
The byte string representing the signature value is placed in the Countersignatur
3.3. Signing and Verification Process
In order to create a signature, a well-defined byte string is needed.
The Countersign
- context:
-
A context text string identifying the context of the signature. The context text string is one of the following:¶
- body_protected:
- The serialized protected attributes from the target structure, encoded in a bstr type. If there are no protected attributes, a zero-length byte string is used.¶
- sign_protected:
-
The serialized protected attributes from the signer structure, encoded in a bstr type.
If there are no protected attributes, a zero-length byte string is used.
This field is omitted for the Countersignatur
e0V2 attribute.¶ - external_aad:
- The externally supplied additional authenticated data (AAD) from the application, encoded in a bstr type. If this field is not supplied, it defaults to a zero-length byte string. (See Section 4.4 of [RFC9052] for application guidance on constructing this field.)¶
- payload:
- The payload to be signed, encoded in a bstr type. The payload is placed here independently of how it is transported.¶
- other_fields:
- Omitted if there are only two bstr fields in the target structure. This field is an array of all bstr fields after the second. As an example, this would be an array of one element for the COSE_Sign1 structure containing the signature value.¶
The CDDL fragment that describes the above text is:¶
How to compute a countersignatur
The steps for verifying a countersignatur
In addition to performing the signature verification, the application performs the appropriate checks to ensure that the key is correctly paired with the signing identity and that the signing identity is authorized before performing actions.¶
4. CBOR Encoding Restrictions
The deterministic encoding rules are defined in Section 4.2 of [RFC8949]. These rules are further narrowed in Section 9 of [RFC9052]. The narrowed deterministic encoding rules MUST be used to ensure that all implementations generate the same byte string for the "to be signed" value.¶
5. IANA Considerations
The registries and registrations listed below were created during the processing of [RFC8152]. The majority of the actions are to update the references to point to this document.¶
5.1. CBOR Tags Registry
IANA created a registry titled "CBOR Tags" registry as part of processing RFC 7049, which was subsequently replaced by [RFC8949].¶
IANA has assigned a new tag for the Counter
5.2. COSE Header Parameters Registry
IANA created a registry titled "COSE Header Parameters" as part of processing [RFC8152].¶
IANA has registered the Countersignatur
IANA has modified the existing "Description" field for "counter signature" (7)
and "Counter
6. Security Considerations
Please review the Security Considerations section in [RFC9052]; these considerations apply to this document as well, especially the need for implementations to protect private key material.¶
When either COSE_Encrypt or COSE_Mac is used and more than two parties share the key, data origin authentication is not provided. Any party that knows the message
Countersignatur
7. References
7.1. Normative References
- [RFC2119]
-
Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10
.17487 , , <https:///RFC2119 www >..rfc -editor .org /info /rfc2119 - [RFC8174]
-
Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10
.17487 , , <https:///RFC8174 www >..rfc -editor .org /info /rfc8174 - [RFC9052]
-
Schaad, J., "CBOR Object Signing and Encryption (COSE): Structures and Process", STD 96, RFC 9052, DOI 10
.17487 , , <https:///RFC9052 www >..rfc -editor .org /info /rfc9052
7.2. Informative References
- [CBORDIAG]
-
Bormann, C., "CBOR diagnostic utilities", commit 1952a04, , <https://
github >..com /cabo /cbor -diag - [GROUP-OSCORE]
-
Tiloca, M., Selander, G., Palombini, F., Mattsson, J., and J. Park, "Group OSCORE - Secure Group Communication for CoAP", Work in Progress, Internet-Draft, draft
-ietf , , <https://-core -oscore -groupcomm -16 datatracker >..ietf .org /doc /html /draft -ietf -core -oscore -groupcomm -16 - [RFC4998]
-
Gondrom, T., Brandner, R., and U. Pordesch, "Evidence Record Syntax (ERS)", RFC 4998, DOI 10
.17487 , , <https:///RFC4998 www >..rfc -editor .org /info /rfc4998 - [RFC7252]
-
Shelby, Z., Hartke, K., and C. Bormann, "The Constrained Application Protocol (CoAP)", RFC 7252, DOI 10
.17487 , , <https:///RFC7252 www >..rfc -editor .org /info /rfc7252 - [RFC8152]
-
Schaad, J., "CBOR Object Signing and Encryption (COSE)", RFC 8152, DOI 10
.17487 , , <https:///RFC8152 www >..rfc -editor .org /info /rfc8152 - [RFC8610]
-
Birkholz, H., Vigano, C., and C. Bormann, "Concise Data Definition Language (CDDL): A Notational Convention to Express Concise Binary Object Representation (CBOR) and JSON Data Structures", RFC 8610, DOI 10
.17487 , , <https:///RFC8610 www >..rfc -editor .org /info /rfc8610 - [RFC8613]
-
Selander, G., Mattsson, J., Palombini, F., and L. Seitz, "Object Security for Constrained RESTful Environments (OSCORE)", RFC 8613, DOI 10
.17487 , , <https:///RFC8613 www >..rfc -editor .org /info /rfc8613 - [RFC8949]
-
Bormann, C. and P. Hoffman, "Concise Binary Object Representation (CBOR)", STD 94, RFC 8949, DOI 10
.17487 , , <https:///RFC8949 www >..rfc -editor .org /info /rfc8949 - [STD90]
-
Bray, T., Ed., "The JavaScript Object Notation (JSON) Data Interchange Format", STD 90, RFC 8259, .<https://
www >.rfc -editor .org /info /std90
Appendix A. Examples
This appendix includes a set of examples that show the different features and message types that have been defined in this document. To make the examples easier to read, they are presented using the extended CBOR diagnostic notation (defined in [RFC8610]) rather than as a binary dump.¶
The examples are presented using the CBOR diagnostic notation. A Ruby-based tool exists [CBORDIAG] that can convert between the diagnostic notation and binary. The referenced webpage includes installation instructions.¶
The diagnostic notation can be converted into binary files using the following command line:¶
The examples can be extracted from the XML version of this document via an XPath expression, as all of the sourcecode is tagged with the attribute 'type
This appendix uses the following terms:¶
- AES-GCM:
- AES Galois/Counter Mode¶
- CEK:
- content
-encryption key¶ - ECDH:
- Elliptic Curve Diffie-Hellman¶
- ECDH-ES:
- Elliptic Curve Diffie-Hellman Ephemeral Static¶
- ECDSA:
- Elliptic Curve Digital Signature Algorithm¶
- EdDSA:
- Edwards-curve Digital Signature Algorithm¶
- HKDF:
- HMAC-based Key Derivation Function¶
- HMAC:
- Hashed Message Authentication Code¶
Acknowledgments
This document is a product of the COSE Working Group of the IETF.¶
The initial draft version of the specification was based to some degree on the outputs of the JOSE and S/MIME Working Groups.¶
Jim Schaad passed on 3 October 2020. This document is primarily his work. Russ Housley served as the document editor after Jim's untimely death, mostly helping with the approval and publication processes. Jim deserves all credit for the technical content.¶
Jim Schaad and Jonathan Hammell provided the examples in Appendix A.¶
The reviews by Carsten Bormann, Ben Kaduk, and Elwyn Davies greatly improved the clarity of the document.¶