--- 1/draft-ietf-cose-rfc8152bis-struct-03.txt 2019-08-18 11:15:47.594384954 -0700 +++ 2/draft-ietf-cose-rfc8152bis-struct-04.txt 2019-08-18 11:15:47.738388595 -0700 @@ -1,19 +1,19 @@ COSE Working Group J. Schaad Internet-Draft August Cellars -Obsoletes: 8152 (if approved) June 10, 2019 +Obsoletes: 8152 (if approved) August 17, 2019 Intended status: Standards Track -Expires: December 12, 2019 +Expires: February 18, 2020 CBOR Object Signing and Encryption (COSE): Structures and Process - draft-ietf-cose-rfc8152bis-struct-03 + draft-ietf-cose-rfc8152bis-struct-04 Abstract Concise Binary Object Representation (CBOR) is a data format designed for small code size and small message size. There is a need for the ability to have basic security services defined for this data format. This document defines the CBOR Object Signing and Encryption (COSE) protocol. This specification describes how to create and process signatures, message authentication codes, and encryption using CBOR for serialization. This specification additionally describes how to @@ -38,21 +38,21 @@ Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at https://datatracker.ietf.org/drafts/current/. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." - This Internet-Draft will expire on December 12, 2019. + This Internet-Draft will expire on February 18, 2020. Copyright Notice Copyright (c) 2019 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://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents @@ -62,78 +62,79 @@ the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License. Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 1.1. Design Changes from JOSE . . . . . . . . . . . . . . . . 5 1.2. Changes from RFC8152 . . . . . . . . . . . . . . . . . . 6 1.3. Requirements Terminology . . . . . . . . . . . . . . . . 6 1.4. CBOR Grammar . . . . . . . . . . . . . . . . . . . . . . 6 - 1.5. CBOR-Related Terminology . . . . . . . . . . . . . . . . 7 + 1.5. CBOR-Related Terminology . . . . . . . . . . . . . . . . 8 1.6. Document Terminology . . . . . . . . . . . . . . . . . . 8 - 2. Basic COSE Structure . . . . . . . . . . . . . . . . . . . . 8 + 2. Basic COSE Structure . . . . . . . . . . . . . . . . . . . . 9 3. Header Parameters . . . . . . . . . . . . . . . . . . . . . . 11 3.1. Common COSE Headers Parameters . . . . . . . . . . . . . 13 4. Signing Objects . . . . . . . . . . . . . . . . . . . . . . . 17 4.1. Signing with One or More Signers . . . . . . . . . . . . 17 4.2. Signing with One Signer . . . . . . . . . . . . . . . . . 19 4.3. Externally Supplied Data . . . . . . . . . . . . . . . . 20 4.4. Signing and Verification Process . . . . . . . . . . . . 21 5. Counter Signatures . . . . . . . . . . . . . . . . . . . . . 22 5.1. Full Countersignatures . . . . . . . . . . . . . . . . . 23 5.2. Abbreviated Countersignatures . . . . . . . . . . . . . . 24 - 6. Encryption Objects . . . . . . . . . . . . . . . . . . . . . 24 + 6. Encryption Objects . . . . . . . . . . . . . . . . . . . . . 25 6.1. Enveloped COSE Structure . . . . . . . . . . . . . . . . 25 - 6.1.1. Content Key Distribution Methods . . . . . . . . . . 26 + 6.1.1. Content Key Distribution Methods . . . . . . . . . . 27 6.2. Single Recipient Encrypted . . . . . . . . . . . . . . . 27 6.3. How to Encrypt and Decrypt for AEAD Algorithms . . . . . 28 6.4. How to Encrypt and Decrypt for AE Algorithms . . . . . . 30 7. MAC Objects . . . . . . . . . . . . . . . . . . . . . . . . . 31 7.1. MACed Message with Recipients . . . . . . . . . . . . . . 32 7.2. MACed Messages with Implicit Key . . . . . . . . . . . . 33 7.3. How to Compute and Verify a MAC . . . . . . . . . . . . . 34 8. Key Objects . . . . . . . . . . . . . . . . . . . . . . . . . 35 8.1. COSE Key Common Parameters . . . . . . . . . . . . . . . 36 - 9. Signature Algorithms . . . . . . . . . . . . . . . . . . . . 38 - 10. Message Authentication Code (MAC) Algorithms . . . . . . . . 39 - 11. Content Encryption Algorithms . . . . . . . . . . . . . . . . 40 - 12. Key Derivation Functions (KDFs) . . . . . . . . . . . . . . . 40 - 13. Content Key Distribution Methods . . . . . . . . . . . . . . 41 - 13.1. Direct Encryption . . . . . . . . . . . . . . . . . . . 41 - 13.2. Key Wrap . . . . . . . . . . . . . . . . . . . . . . . . 42 - 13.3. Key Transport . . . . . . . . . . . . . . . . . . . . . 42 - 13.4. Direct Key Agreement . . . . . . . . . . . . . . . . . . 43 - 13.5. Key Agreement with Key Wrap . . . . . . . . . . . . . . 44 - 14. CBOR Encoding Restrictions . . . . . . . . . . . . . . . . . 44 - 15. Application Profiling Considerations . . . . . . . . . . . . 44 - 16. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 46 - 16.1. CBOR Tag Assignment . . . . . . . . . . . . . . . . . . 46 - 16.2. COSE Header Parameters Registry . . . . . . . . . . . . 46 - 16.3. COSE Header Algorithm Parameters Registry . . . . . . . 47 - 16.4. COSE Key Common Parameters Registry . . . . . . . . . . 47 - 16.5. Media Type Registrations . . . . . . . . . . . . . . . . 47 - 16.5.1. COSE Security Message . . . . . . . . . . . . . . . 47 - 16.5.2. COSE Key Media Type . . . . . . . . . . . . . . . . 48 - 16.6. CoAP Content-Formats Registry . . . . . . . . . . . . . 50 - 17. Security Considerations . . . . . . . . . . . . . . . . . . . 50 - 18. Implementation Status . . . . . . . . . . . . . . . . . . . . 52 - 18.1. Author's Versions . . . . . . . . . . . . . . . . . . . 53 - 18.2. Java Script Version . . . . . . . . . . . . . . . . . . 53 - 18.3. Python Version . . . . . . . . . . . . . . . . . . . . . 54 - 18.4. COSE Testing Library . . . . . . . . . . . . . . . . . . 54 - 19. References . . . . . . . . . . . . . . . . . . . . . . . . . 55 - 19.1. Normative References . . . . . . . . . . . . . . . . . . 55 - 19.2. Informative References . . . . . . . . . . . . . . . . . 56 + 9. Taxonomy of Algorithms used by COSE . . . . . . . . . . . . . 38 + 9.1. Signature Algorithms . . . . . . . . . . . . . . . . . . 38 + 9.2. Message Authentication Code (MAC) Algorithms . . . . . . 39 + 9.3. Content Encryption Algorithms . . . . . . . . . . . . . . 40 + 9.4. Key Derivation Functions (KDFs) . . . . . . . . . . . . . 41 + 9.5. Content Key Distribution Methods . . . . . . . . . . . . 41 + 9.5.1. Direct Encryption . . . . . . . . . . . . . . . . . . 41 + 9.5.2. Key Wrap . . . . . . . . . . . . . . . . . . . . . . 42 + 9.5.3. Key Transport . . . . . . . . . . . . . . . . . . . . 43 + 9.5.4. Direct Key Agreement . . . . . . . . . . . . . . . . 43 + 9.5.5. Key Agreement with Key Wrap . . . . . . . . . . . . . 44 + 10. CBOR Encoding Restrictions . . . . . . . . . . . . . . . . . 44 + 11. Application Profiling Considerations . . . . . . . . . . . . 45 + 12. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 46 + 12.1. CBOR Tag Assignment . . . . . . . . . . . . . . . . . . 46 + 12.2. COSE Header Parameters Registry . . . . . . . . . . . . 47 + 12.3. COSE Header Algorithm Parameters Registry . . . . . . . 47 + 12.4. COSE Key Common Parameters Registry . . . . . . . . . . 47 + 12.5. Media Type Registrations . . . . . . . . . . . . . . . . 47 + 12.5.1. COSE Security Message . . . . . . . . . . . . . . . 47 + 12.5.2. COSE Key Media Type . . . . . . . . . . . . . . . . 48 + 12.6. CoAP Content-Formats Registry . . . . . . . . . . . . . 50 + 13. Security Considerations . . . . . . . . . . . . . . . . . . . 51 + 14. Implementation Status . . . . . . . . . . . . . . . . . . . . 53 + 14.1. Author's Versions . . . . . . . . . . . . . . . . . . . 53 + 14.2. JavaScript Version . . . . . . . . . . . . . . . . . . . 54 + 14.3. Python Version . . . . . . . . . . . . . . . . . . . . . 54 + 14.4. COSE Testing Library . . . . . . . . . . . . . . . . . . 55 + 15. References . . . . . . . . . . . . . . . . . . . . . . . . . 55 + 15.1. Normative References . . . . . . . . . . . . . . . . . . 55 + 15.2. Informative References . . . . . . . . . . . . . . . . . 56 Appendix A. Guidelines for External Data Authentication of - Algorithms . . . . . . . . . . . . . . . . . . . . . 58 - Appendix B. Two Layers of Recipient Information . . . . . . . . 61 + Algorithms . . . . . . . . . . . . . . . . . . . . . 59 + Appendix B. Two Layers of Recipient Information . . . . . . . . 62 Appendix C. Examples . . . . . . . . . . . . . . . . . . . . . . 63 C.1. Examples of Signed Messages . . . . . . . . . . . . . . . 64 C.1.1. Single Signature . . . . . . . . . . . . . . . . . . 64 C.1.2. Multiple Signers . . . . . . . . . . . . . . . . . . 65 C.1.3. Counter Signature . . . . . . . . . . . . . . . . . . 66 C.1.4. Signature with Criticality . . . . . . . . . . . . . 67 C.2. Single Signer Examples . . . . . . . . . . . . . . . . . 68 C.2.1. Single ECDSA Signature . . . . . . . . . . . . . . . 68 C.3. Examples of Enveloped Messages . . . . . . . . . . . . . 69 C.3.1. Direct ECDH . . . . . . . . . . . . . . . . . . . . . 69 @@ -192,40 +192,40 @@ the criteria were not always the same. This document contains: o The description of the structure for the CBOR objects which are transmitted over the wire. Two objects are defined for encryption, signing and message authentication. One object is defined for transporting keys and one for transporting groups of keys. - o The procedures used to compute build the inputs to the - cryptographic functions required for each of the structures. + o The procedures used to build the inputs to the cryptographic + functions required for each of the structures. o A starting set of attributes that apply to the different security objects. This document does not contain the rules and procedures for using specific cryptographic algorithms. Details on specific algorithms can be found in [I-D.ietf-cose-rfc8152bis-algs] and [RFC8230]. Details for additional algorithms are expected to be defined in future documents. One feature that is present in CMS [RFC5652] that is not present in this standard is a digest structure. This omission is deliberate. It is better for the structure to be defined in each document as different protocols will want to include a different set of fields as part of the structure. While an algorithm identifier and the digesst value are going to be common to all applications, the two values may not always be adjacent as the algorithm could be defined once with - multiple values. Applications may additionally want to defined + multiple values. Applications may additionally want to define additional data fields as part of the stucture. A common structure is going to include a URI or other pointer to where the data that is being hashed is kept, allowing this to be application specific. 1.1. Design Changes from JOSE o Define a single top message structure so that encrypted, signed, and MACed messages can easily be identified and still have a consistent view. @@ -250,43 +250,43 @@ 1.2. Changes from RFC8152 o Split the orignal document into this document and [I-D.ietf-cose-rfc8152bis-algs]. o Add some text describing why there is no digest structure defined by COSE. o Rearrange the text around counter signatures and define a CBOR Tag - for a standalong countersignature. + for a standalone countersignature. 1.3. 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.4. CBOR Grammar There was not a standard CBOR grammar available when COSE was originally written. For that reason the CBOR structures defined here are described in prose. Since that time CBOR Data Definition - Language (CDDL) [I-D.ietf-cbor-cddl] has been published as an RFC. - The CBOR grammar presented in this document is compatible with CDDL. + Language (CDDL) [RFC8610] has been published as an RFC. The CBOR + grammar presented in this document is compatible with CDDL. The document was developed by first working on the grammar and then developing the prose to go with it. An artifact of this is that the prose was written using the primitive type strings defined by CBOR - Data Definition Language (CDDL) [I-D.ietf-cbor-cddl]. In this - specification, the following primitive types are used: + Data Definition Language (CDDL) [RFC8610]. In this specification, + the following primitive types are used: any -- non-specific value that permits all CBOR values to be placed here. bool -- a boolean value (true: major type 7, value 21; false: major type 7, value 20). bstr -- byte string (major type 2). int -- an unsigned integer or a negative integer. @@ -300,20 +300,29 @@ uint -- an unsigned integer (major type 0). Two syntaxes from CDDL appear in this document as shorthand. These are: FOO / BAR -- indicates that either FOO or BAR can appear here. [+ FOO] -- indicates that the type FOO appears one or more times in an array. + Two of the constraints defined by CDDL are also used in this + document. These are: + + type1 .cbor type2 -- indicates that the contents of type1, usually + bstr, contains a value of type2. + + type1 .size integer -- indicates that the contents of type1 is + integer bytes long + As well as the prose description, a version of a CBOR grammar is presented in CDDL. The CDDL grammar is informational; the prose description is normative. The collected CDDL can be extracted from the XML version of this document via the following XPath expression below. (Depending on the XPath evaluator one is using, it may be necessary to deal with > as an entity.) //artwork[@type='CDDL']/text() @@ -360,25 +368,34 @@ Byte is a synonym for octet. Constrained Application Protocol (CoAP) is a specialized web transfer protocol for use in constrained systems. It is defined in [RFC7252]. Authenticated Encryption (AE) [RFC5116] algorithms are those encryption algorithms that provide an authentication check of the contents algorithm with the encryption service. - Authenticated Encryption with Authenticated Data (AEAD) [RFC5116] + Authenticated Encryption with Associated Data (AEAD) [RFC5116] algorithms provide the same content authentication service as AE algorithms, but they additionally provide for authentication of non- encrypted data as well. + Context is used throughout the document to represent information that + is not part of the COSE message. Information which is part of the + context can come from several different sources including: Protocol + interactions, associated key structures and program configuration. + The context to use can be implicit, identified using the 'kid + context' header field defined in [RFC8613], or identified by a + protocol specific identifier. Context should generally be included + in the cryptographic configuration, for more details see Section 4.3. + 2. Basic COSE Structure The COSE object structure is designed so that there can be a large amount of common code when parsing and processing the different types of security messages. All of the message structures are built on the CBOR array type. The first three elements of the array always contain the same information: 1. The set of protected header parameters wrapped in a bstr. @@ -423,60 +441,67 @@ the untagged version of the structure is used. The value to use with the parameter for each of the structures can be found in Table 1. 4. When a COSE object is carried as a CoAP payload, the CoAP Content-Format Option can be used to identify the message content. The CoAP Content-Format values can be found in Table 2. The CBOR tag for the message structure is not required as each security message is uniquely identified. - +-------+------------------+----------------+-----------------------+ + +------+------------------+-----------------------+-----------------+ | CBOR | cose-type | Data Item | Semantics | | Tag | | | | - +-------+------------------+----------------+-----------------------+ - | 98 | cose-sign | COSE_Sign | COSE Signed Data | + +------+------------------+-----------------------+-----------------+ + | 98 | cose-sign | COSE_Sign | COSE Signed | + | | | | Data Object | + | 18 | cose-sign1 | COSE_Sign1 | COSE Single | + | | | | Signer Data | | | | | Object | - | 18 | cose-sign1 | COSE_Sign1 | COSE Single Signer | + | 96 | cose-encrypt | COSE_Encrypt | COSE Encrypted | | | | | Data Object | - | 96 | cose-encrypt | COSE_Encrypt | COSE Encrypted Data | + | 16 | cose-encrypt0 | COSE_Encrypt0 | COSE Single | + | | | | Recipient | + | | | | Encrypted Data | | | | | Object | - | 16 | cose-encrypt0 | COSE_Encrypt0 | COSE Single Recipient | - | | | | Encrypted Data Object | | 97 | cose-mac | COSE_Mac | COSE MACed Data | | | | | Object | | 17 | cose-mac0 | COSE_Mac0 | COSE Mac w/o | - | | | | Recipients Object | - | TBD0 | cose-countersign | COSE_Signature | COSE standalone | - | | | | counter signature | - +-------+------------------+----------------+-----------------------+ + | | | | Recipients | + | | | | Object | + | TBD0 | cose-countersign | COSE_Countersignature | COSE standalone | + | | | | counter | + | | | | signature | + +------+------------------+-----------------------+-----------------+ Table 1: COSE Message Identification - +--------------------------------------+----------+-----+-----------+ + +----------------------------------+----------+-----+---------------+ | Media Type | Encoding | ID | Reference | - +--------------------------------------+----------+-----+-----------+ - | application/cose; cose-type="cose- | | 98 | [RFC8152] | - | sign" | | | | - | application/cose; cose-type="cose- | | 18 | [RFC8152] | - | sign1" | | | | - | application/cose; cose-type="cose- | | 96 | [RFC8152] | - | encrypt" | | | | - | application/cose; cose-type="cose- | | 16 | [RFC8152] | - | encrypt0" | | | | - | application/cose; cose-type="cose- | | 97 | [RFC8152] | - | mac" | | | | - | application/cose; cose-type="cose- | | 17 | [RFC8152] | - | mac0" | | | | - | application/cose-key | | 101 | [RFC8152] | - | application/cose-key-set | | 102 | [RFC8152] | - +--------------------------------------+----------+-----+-----------+ + +----------------------------------+----------+-----+---------------+ + | application/cose; cose-type | | 98 | [[THIS | + | ="cose-sign" | | | DOCUMENT]] | + | application/cose; cose-type | | 18 | [[THIS | + | ="cose-sign1" | | | DOCUMENT]] | + | application/cose; cose-type | | 96 | [[THIS | + | ="cose-encrypt" | | | DOCUMENT]] | + | application/cose; cose-type | | 16 | [[THIS | + | ="cose-encrypt0" | | | DOCUMENT]] | + | application/cose; cose-type | | 97 | [[THIS | + | ="cose-mac" | | | DOCUMENT]] | + | application/cose; cose-type | | 17 | [[THIS | + | ="cose-mac0" | | | DOCUMENT]] | + | application/cose-key | | 101 | [[THIS | + | | | | DOCUMENT]] | + | application/cose-key-set | | 102 | [[THIS | + | | | | DOCUMENT]] | + +----------------------------------+----------+-----+---------------+ Table 2: CoAP Content-Formats for COSE The following CDDL fragment identifies all of the top messages defined in this document. Separate non-terminals are defined for the tagged and the untagged versions of the messages. COSE_Messages = COSE_Untagged_Message / COSE_Tagged_Message COSE_Untagged_Message = COSE_Sign / COSE_Sign1 / @@ -500,23 +525,23 @@ recipient structures do not provide for authenticated data. If this is the case, the protected bucket is left empty. Both buckets are implemented as CBOR maps. The map key is a 'label' (Section 1.5). The value portion is dependent on the definition for the label. Both maps use the same set of label/value pairs. The integer and string values for labels have been divided into several sections including a standard range, a private range, and a range that is dependent on the algorithm selected. The defined labels can be found in the "COSE Header Parameters" IANA registry - (Section 16.2). + (Section 12.2). - Two buckets are provided for each layer: + The two buckets are: protected: Contains parameters about the current layer that are cryptographically protected. This bucket MUST be empty if it is not going to be included in a cryptographic computation. This bucket is encoded in the message as a binary object. This value is obtained by CBOR encoding the protected map and wrapping it in a bstr object. Senders SHOULD encode a zero-length map as a zero- length byte string rather than as a zero-length map (encoded as h'a0'). The zero-length binary encoding is preferred because it is both shorter and the version used in the serialization @@ -541,21 +566,21 @@ not placed in the recipient or signature layers. In principle, one should be able to process any given layer without reference to any other layer. With the exception of the COSE_Sign structure, the only data that needs to cross layers is the cryptographic key. The buckets are present in all of the security objects defined in this document. The fields in order are the 'protected' bucket (as a CBOR 'bstr' type) and then the 'unprotected' bucket (as a CBOR 'map' type). The presence of both buckets is required. The parameters that go into the buckets come from the IANA "COSE Header Parameters" - registry (Section 16.2). Some common parameters are defined in the + registry (Section 12.2). Some common parameters are defined in the next section. Labels in each of the maps MUST be unique. When processing messages, if a label appears multiple times, the message MUST be rejected as malformed. Applications SHOULD verify that the same label does not occur in both the protected and unprotected headers. If the message is not rejected as malformed, attributes MUST be obtained from the protected bucket before they are obtained from the unprotected bucket. @@ -650,27 +675,28 @@ unprotected headers bucket. IV: This parameter holds the Initialization Vector (IV) value. For some symmetric encryption algorithms, this may be referred to as a nonce. The IV can be placed in the unprotected header as modifying the IV will cause the decryption to yield plaintext that is readily detectable as garbled. Partial IV: This parameter holds a part of the IV value. When using the COSE_Encrypt0 structure, a portion of the IV can be part of - the context associated with the key. This field is used to carry - a value that causes the IV to be changed for each message. The IV - can be placed in the unprotected header as modifying the IV will - cause the decryption to yield plaintext that is readily detectable - as garbled. The 'Initialization Vector' and 'Partial - Initialization Vector' parameters MUST NOT both be present in the - same security layer. + the context associated with the key (Context IV) while a portion + can be changed with each message (Parital IV). This field is used + to carry a value that causes the IV to be changed for each + message. The Parital IV can be placed in the unprotected header + as modifying the value will cause the decryption to yield + plaintext that is readily detectable as garbled. The + 'Initialization Vector' and 'Partial Initialization Vector' + parameters MUST NOT both be present in the same security layer. The message IV is generated by the following steps: 1. Left-pad the Partial IV with zeros to the length of IV. 2. XOR the padded Partial IV with the context IV. counter signature: This parameter holds one or more counter signature values. Counter signatures provide a method of having a second party sign some data. The counter signature parameter can @@ -793,25 +819,25 @@ payload: This field contains the serialized content to be signed. If the payload is not present in the message, the application is required to supply the payload separately. The payload is wrapped in a bstr to ensure that it is transported without changes. If the payload is transported separately ("detached content"), then a nil CBOR object is placed in this location, and it is the responsibility of the application to ensure that it will be transported without changes. Note: When a signature with a message recovery algorithm is used - (Section 9), the maximum number of bytes that can be recovered is - the length of the payload. The size of the payload is reduced by - the number of bytes that will be recovered. If all of the bytes - of the payload are consumed, then the payload is encoded as a - zero-length binary string rather than as being absent. + (Section 9.1), the maximum number of bytes that can be recovered + is the length of the payload. The size of the payload is reduced + by the number of bytes that will be recovered. If all of the + bytes of the payload are consumed, then the payload is encoded as + a zero-length binary string rather than as being absent. signatures: This field is an array of signatures. Each signature is represented as a COSE_Signature structure. The CDDL fragment that represents the above text for COSE_Sign follows. COSE_Sign = [ Headers, payload : bstr / nil, @@ -957,49 +983,52 @@ type. If this field is not supplied, it defaults to a zero- length binary string. (See Section 4.3 for application guidance on constructing this field.) 5. The payload to be signed encoded in a bstr type. The payload is placed here independent of how it is transported. The CDDL fragment that describes the above text is: Sig_structure = [ - context : "Signature" / "Signature1" / "CounterSignature", + context : "Signature" / "Signature1" / "CounterSignature" / + "CounterSignature0", body_protected : empty_or_serialized_map, ? sign_protected : empty_or_serialized_map, external_aad : bstr, payload : bstr ] How to compute a signature: 1. Create a Sig_structure and populate it with the appropriate fields. 2. Create the value ToBeSigned by encoding the Sig_structure to a - byte string, using the encoding described in Section 14. + byte string, using the encoding described in Section 10. 3. Call the signature creation algorithm passing in K (the key to sign with), alg (the algorithm to sign with), and ToBeSigned (the value to sign). - 4. Place the resulting signature value in the 'signature' field of - the array. + 4. Place the resulting signature value in the correct location. + This is the 'signature' field of the COSE_Signature, COSE_Sign1 + or COSE_Countersignature structures. This is the value of the + Countersignature0 attribute. The steps for verifying a signature are: 1. Create a Sig_structure object and populate it with the appropriate fields. 2. Create the value ToBeSigned by encoding the Sig_structure to a - byte string, using the encoding described in Section 14. + byte string, using the encoding described in Section 10. 3. Call the signature verification algorithm passing in K (the key to verify with), alg (the algorithm used sign with), ToBeSigned (the value to sign), and sig (the signature to be verified). 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. @@ -1017,78 +1046,79 @@ signature validation. COSE was designed for uniformity in how the data strutures are specified. One result of this is that for COSE one can expand the concept of countersignatures beyond just the idea of signing a signature to being able to sign most of the structures without having to create a new signing layer. When creating a countersignature, one needs to be clear about the security properties that result. When done on a COSE_Signature, the normal countersignature semantics are preserved. That is the countersignature makes a statement about the - existance of a signature and, when used as a timestamp, a time point + existence of a signature and, when used as a timestamp, a time point at which the signature exists. When done on a COSE_Mac or a COSE_Mac0, one effectively upgrades the MAC operation to a sginature operation. When done on a COSE_Encrypt or COSE_Encrypt0, the - existance of the encrypted data is attested to. It should be noted - that there is a big difference between attesting to the enrypted data - as oppose to attesting to the unencrypted data. If the latter is - what is desired, then one needs to apply a signature to the data and - then encrypt that. It is always possible to construct cases where - the decryption is successful, while providing completely different - answers by using a different key. This situation is not detectable - by a countersignature on the encrypted data. + existence of the encrypted data is attested to. It should be noted + that there is a big difference between attesting to the encrypted + data as opposed to attesting to the unencrypted data. If the latter + is what is desired, then one needs to apply a signature to the data + and then encrypt that. It is always possible to construct cases + where the decryption is successful, while providing completely + different answers by using a different key. This situation is not + detectable by a countersignature on the encrypted data. 5.1. Full Countersignatures The COSE_Countersignature structure allows for the same set of capabilities of a COSE_Signature. This means that all of the capabilities of a signature are duplicated with this structure. Specifically, the countersigner does not need to be related to the producer of what is being counter signed as key and algorithm identification can be placed in the countersignature attributes. This also means that the countersignature can itself be countersigned. This is a feature required by protocols such as long- term archiving services. More information on how this is used can be found in the evidence record syntax described in [RFC4998]. The full countersignature structure can be encoded as either a tagged or untagged depending on the context it is used in. A tagged - COSE_Countersign steruture is identified byt the CBOR tag TBD0. The + COSE_Countersign structure is identified by the CBOR tag TBD0. The CDDL fragment for full countersignatures is: COSE_CounterSignature_Tagged = #6.98(COSE_CounterSignature) COSE_CounterSignature = COSE_Signature + The details of the fields of a countersignature can be found in Section 4.1. The process of creating and validating abbreviated countersignatures is defined in Section 4.4. An example of a counter signature on a signature can be found in Appendix C.1.3. An example of a counter signature in an encryption object can be found in Appendix C.3.3. It should be noted that only a signature algorithm with appendix (see - Section 9) can be used for counter signatures. This is because the + Section 9.1) can be used for counter signatures. This is because the body should be able to be processed without having to evaluate the counter signature, and this is not possible for signature schemes with message recovery. 5.2. Abbreviated Countersignatures Abbreviated countersignatures were designed primarily to deal with the problem of having group encrypted messaging, but still needing to - know who orginated the message. The object was to keep the + know who originated the message. The objective was to keep the countersignature as small as possible while still providing the needed security. For abbreviated countersignatures, there is no provision for any protected attributes related to the signing - operation. Instead, the context that was used to describe the - encryption processing is also assumed to describe the context that - was used to create the countersignature. + operation. Instead, the parameters for computing or verifying the + abbreviated countersignature are inferred from the same context used + to describe the encryption, signature, or MAC processing. The byte string representing the signature value is placed in the CounterSignature0 attribute. This attribute is then encoded as an unprotected header. The attribute is defined below. The process of creating and validating abbreviated countersignatures is defined in Section 4.4. +-------------------+-------+---------+-------+---------------------+ | Name | Label | Value | Value | Description | @@ -1192,40 +1221,40 @@ ? recipients : [+COSE_recipient] ] 6.1.1. Content Key Distribution Methods An encrypted message consists of an encrypted content and an encrypted CEK for one or more recipients. The CEK is encrypted for each recipient, using a key specific to that recipient. The details of this encryption depend on which class the recipient algorithm falls into. Specific details on each of the classes can be found in - Section 13. A short summary of the five content key distribution + Section 9.5. A short summary of the five content key distribution methods is: direct: The CEK is the same as the identified previously distributed symmetric key or is derived from a previously distributed secret. No CEK is transported in the message. symmetric key-encryption keys (KEK): The CEK is encrypted using a previously distributed symmetric KEK. Also known as key wrap. key agreement: The recipient's public key and a sender's private key are used to generate a pairwise secret, a Key Derivation Function (KDF) is applied to derive a key, and then the CEK is either the derived key or encrypted by the derived key. key transport: The CEK is encrypted with the recipient's public key. - No key transport algorithms are defined in this document. passwords: The CEK is encrypted in a KEK that is derived from a - password. No password algorithms are defined in this document. + password. As of when this document was published, no password + algorithms have been defined. 6.2. Single Recipient Encrypted The COSE_Encrypt0 encrypted structure does not have the ability to specify recipients of the message. The structure assumes that the recipient of the object will already know the identity of the key to be used in order to decrypt the message. If a key needs to be identified to the recipient, the enveloped structure ought to be used. @@ -1291,35 +1320,36 @@ constructing this field.) The CDDL fragment that describes the above text is: Enc_structure = [ context : "Encrypt" / "Encrypt0" / "Enc_Recipient" / "Mac_Recipient" / "Rec_Recipient", protected : empty_or_serialized_map, external_aad : bstr ] + How to encrypt a message: 1. Create an Enc_structure and populate it with the appropriate fields. 2. Encode the Enc_structure to a byte string (Additional Authenticated Data (AAD)), using the encoding described in - Section 14. + Section 10. 3. Determine the encryption key (K). This step is dependent on the class of recipient algorithm being used. For: No Recipients: The key to be used is determined by the algorithm and key at the current layer. Examples are key transport keys - (Section 13.3), key wrap keys (Section 13.2), or pre-shared + (Section 9.5.3), key wrap keys (Section 9.5.2), or pre-shared secrets. Direct Encryption and Direct Key Agreement: The key is determined by the key and algorithm in the recipient structure. The encryption algorithm and size of the key to be used are inputs into the KDF used for the recipient. (For direct, the KDF can be thought of as the identity operation.) Examples of these algorithms are found in Sections 6.1.2 and 6.3 of [I-D.ietf-cose-rfc8152bis-algs]. @@ -1332,28 +1362,28 @@ 5. For recipients of the message, recursively perform the encryption algorithm for that recipient, using K (the encryption key) as the plaintext. How to decrypt a message: 1. Create an Enc_structure and populate it with the appropriate fields. 2. Encode the Enc_structure to a byte string (AAD), using the - encoding described in Section 14. + encoding described in Section 10. 3. Determine the decryption key. This step is dependent on the class of recipient algorithm being used. For: No Recipients: The key to be used is determined by the algorithm and key at the current layer. Examples are key transport keys - (Section 13.3), key wrap keys (Section 13.2), or pre-shared + (Section 9.5.3), key wrap keys (Section 9.5.2), or pre-shared secrets. Direct Encryption and Direct Key Agreement: The key is determined by the key and algorithm in the recipient structure. The encryption algorithm and size of the key to be used are inputs into the KDF used for the recipient. (For direct, the KDF can be thought of as the identity operation.) Other: The key is determined by decoding and decrypting one of the recipient structures. @@ -1368,21 +1398,21 @@ 1. Verify that the 'protected' field is empty. 2. Verify that there was no external additional authenticated data supplied for this operation. 3. Determine the encryption key. This step is dependent on the class of recipient algorithm being used. For: No Recipients: The key to be used is determined by the algorithm and key at the current layer. Examples are key transport keys - (Section 13.3), key wrap keys (Section 13.2), or pre-shared + (Section 9.5.3), key wrap keys (Section 9.5.2), or pre-shared secrets. Direct Encryption and Direct Key Agreement: The key is determined by the key and algorithm in the recipient structure. The encryption algorithm and size of the key to be used are inputs into the KDF used for the recipient. (For direct, the KDF can be thought of as the identity operation.) Examples of these algorithms are found in Sections 6.1.2 and 6.3 of [I-D.ietf-cose-rfc8152bis-algs]. @@ -1401,21 +1431,21 @@ 1. Verify that the 'protected' field is empty. 2. Verify that there was no external additional authenticated data supplied for this operation. 3. Determine the decryption key. This step is dependent on the class of recipient algorithm being used. For: No Recipients: The key to be used is determined by the algorithm and key at the current layer. Examples are key transport keys - (Section 13.3), key wrap keys (Section 13.2), or pre-shared + (Section 9.5.3), key wrap keys (Section 9.5.2), or pre-shared secrets. Direct Encryption and Direct Key Agreement: The key is determined by the key and algorithm in the recipient structure. The encryption algorithm and size of the key to be used are inputs into the KDF used for the recipient. (For direct, the KDF can be thought of as the identity operation.) Examples of these algorithms are found in Sections 6.1.2 and 6.3 of [I-D.ietf-cose-rfc8152bis-algs]. @@ -1563,55 +1593,55 @@ external_aad : bstr, payload : bstr ] The steps to compute a MAC are: 1. Create a MAC_structure and populate it with the appropriate fields. 2. Create the value ToBeMaced by encoding the MAC_structure to a - byte string, using the encoding described in Section 14. + byte string, using the encoding described in Section 10. 3. Call the MAC creation algorithm passing in K (the key to use), alg (the algorithm to MAC with), and ToBeMaced (the value to compute the MAC on). 4. Place the resulting MAC in the 'tag' field of the COSE_Mac or COSE_Mac0 structure. 5. For COSE_Mac structures, encrypt and encode the MAC key for each recipient of the message. The steps to verify a MAC are: 1. Create a MAC_structure object and populate it with the appropriate fields. 2. Create the value ToBeMaced by encoding the MAC_structure to a - byte string, using the encoding described in Section 14. + byte string, using the encoding described in Section 10. 3. For COSE_Mac structures, obtain the cryptographic key from one of the recipients of the message. 4. Call the MAC creation algorithm passing in K (the key to use), alg (the algorithm to MAC with), and ToBeMaced (the value to compute the MAC on). 5. Compare the MAC value to the 'tag' field of the COSE_Mac or COSE_Mac0 structure. 8. Key Objects A COSE Key structure is built on a CBOR map object. The set of common parameters that can appear in a COSE Key can be found in the - IANA "COSE Key Common Parameters" registry (Section 16.4). + IANA "COSE Key Common Parameters" registry (Section 12.4). Additional parameters defined for specific key types can be found in the IANA "COSE Key Type Parameters" registry ([COSE.KeyParameters]). A COSE Key Set uses a CBOR array object as its underlying type. The values of the array elements are COSE Keys. A COSE Key Set MUST have at least one element in the array. Examples of COSE Key Sets can be found in Appendix C.7. Each element in a COSE Key Set MUST be processed independently. If one element in a COSE Key Set is either malformed or uses a key that @@ -1739,21 +1769,28 @@ | derive | 8 | The key is used for deriving bits not to be | | bits | | used as a key. Requires private key fields. | | MAC | 9 | The key is used for creating MACs. | | create | | | | MAC | 10 | The key is used for validating MACs. | | verify | | | +---------+-------+-------------------------------------------------+ Table 6: Key Operation Values -9. Signature Algorithms +9. Taxonomy of Algorithms used by COSE + + In this section, a taxonomy of the different algorithm types that can + be used in COSE is laid out. This taxonomy should not be considered + to be exhaustive as there are new algorithm structures that could be + found or are not known to the author. + +9.1. Signature Algorithms There are two signature algorithm schemes. The first is signature with appendix. In this scheme, the message content is processed and a signature is produced; the signature is called the appendix. This is the scheme used by algorithms such as ECDSA and the RSA Probabilistic Signature Scheme (RSASSA-PSS). (In fact, the SSA in RSASSA-PSS stands for Signature Scheme with Appendix.) The signature functions for this scheme are: @@ -1789,21 +1826,21 @@ valid, message content = Verification(message sent, key, signature) Signature algorithms are used with the COSE_Signature and COSE_Sign1 structures. At this time, only signatures with appendixes are defined for use with COSE; however, considerable interest has been expressed in using a signature with message recovery algorithm due to the effective size reduction that is possible. Implementations will need to keep this in mind for later possible integration. -10. Message Authentication Code (MAC) Algorithms +9.2. Message Authentication Code (MAC) Algorithms Message Authentication Codes (MACs) provide data authentication and integrity protection. They provide either no or very limited data origination. A MAC, for example, cannot be used to prove the identity of the sender to a third party. MACs use the same scheme as signature with appendix algorithms. The message content is processed and an authentication code is produced. The authentication code is frequently called a tag. @@ -1805,28 +1842,29 @@ MACs use the same scheme as signature with appendix algorithms. The message content is processed and an authentication code is produced. The authentication code is frequently called a tag. The MAC functions are: tag = MAC_Create(message content, key) valid = MAC_Verify(message content, key, tag) + MAC algorithms can be based on either a block cipher algorithm (i.e., AES-MAC) or a hash algorithm (i.e., a Hash-based Message - Authentication Code (HMAC)). This document defines a MAC algorithm - using each of these constructions. + Authentication Code (HMAC)). [I-D.ietf-cose-rfc8152bis-algs] defines + a MAC algorithm using each of these constructions. MAC algorithms are used in the COSE_Mac and COSE_Mac0 structures. -11. Content Encryption Algorithms +9.3. Content Encryption Algorithms Content encryption algorithms provide data confidentiality for potentially large blocks of data using a symmetric key. They provide integrity on the data that was encrypted; however, they provide either no or very limited data origination. (One cannot, for example, be used to prove the identity of the sender to a third party.) The ability to provide data origination is linked to how the CEK is obtained. COSE restricts the set of legal content encryption algorithms to @@ -1841,21 +1879,21 @@ valid, message content = Decrypt(ciphertext, key, additional data) Most AEAD algorithms are logically defined as returning the message content only if the decryption is valid. Many but not all implementations will follow this convention. The message content MUST NOT be used if the decryption does not validate. These algorithms are used in COSE_Encrypt and COSE_Encrypt0. -12. Key Derivation Functions (KDFs) +9.4. Key Derivation Functions (KDFs) KDFs are used to take some secret value and generate a different one. The secret value comes in three flavors: o Secrets that are uniformly random: This is the type of secret that is created by a good random number generator. o Secrets that are not uniformly random: This is type of secret that is created by operations like key agreement. @@ -1872,52 +1910,52 @@ [I-D.ietf-cose-rfc8152bis-algs] is such a function. This is reflected in the set of algorithms defined around the HMAC-based Extract-and-Expand Key Derivation Function (HKDF). When using KDFs, one component that is included is context information. Context information is used to allow for different keying information to be derived from the same secret. The use of context-based keying material is considered to be a good security practice. -13. Content Key Distribution Methods +9.5. Content Key Distribution Methods Content key distribution methods (recipient algorithms) can be defined into a number of different classes. COSE has the ability to support many classes of recipient algorithms. In this section, a number of classes are listed. The names of the recipient algorithm classes used here are the same as those defined in [RFC7516]. Other specifications use different terms for the recipient algorithm classes or do not support some of the recipient algorithm classes. -13.1. Direct Encryption +9.5.1. Direct Encryption The direct encryption class algorithms share a secret between the sender and the recipient that is used either directly or after manipulation as the CEK. When direct encryption mode is used, it MUST be the only mode used on the message. The COSE_Recipient structure for the recipient is organized as follows: o The 'protected' field MUST be a zero-length item unless it is used in the computation of the content key. o The 'alg' parameter MUST be present. o A parameter identifying the shared secret SHOULD be present. o The 'ciphertext' field MUST be a zero-length item. o The 'recipients' field MUST be absent. -13.2. Key Wrap +9.5.2. Key Wrap In key wrap mode, the CEK is randomly generated and that key is then encrypted by a shared secret between the sender and the recipient. All of the currently defined key wrap algorithms for COSE are AE algorithms. Key wrap mode is considered to be superior to direct encryption if the system has any capability for doing random key generation. This is because the shared key is used to wrap random data rather than data that has some degree of organization and may in fact be repeating the same content. The use of key wrap loses the weak data origination that is provided by the direct encryption @@ -1934,41 +1972,41 @@ recipient is an acceptable way of dealing with it. Failing to process the message is not an acceptable way of dealing with it. o The plaintext to be encrypted is the key from next layer down (usually the content layer). o At a minimum, the 'unprotected' field MUST contain the 'alg' parameter and SHOULD contain a parameter identifying the shared secret. -13.3. Key Transport +9.5.3. Key Transport Key transport mode is also called key encryption mode in some standards. Key transport mode differs from key wrap mode in that it uses an asymmetric encryption algorithm rather than a symmetric encryption algorithm to protect the key. A set of key transport algorithms are defined in [RFC8230]. When using a key transport algorithm, the COSE_Encrypt structure for the recipient is organized as follows: o The 'protected' field MUST be absent. o The plaintext to be encrypted is the key from the next layer down (usually the content layer). o At a minimum, the 'unprotected' field MUST contain the 'alg' parameter and SHOULD contain a parameter identifying the asymmetric key. -13.4. Direct Key Agreement +9.5.4. Direct Key Agreement The 'direct key agreement' class of recipient algorithms uses a key agreement method to create a shared secret. A KDF is then applied to the shared secret to derive a key to be used in protecting the data. This key is normally used as a CEK or MAC key, but could be used for other purposes if more than two layers are in use (see Appendix B). The most commonly used key agreement algorithm is Diffie-Hellman, but other variants exist. Since COSE is designed for a store and forward environment rather than an online environment, many of the DH @@ -1999,75 +2037,74 @@ The COSE_Encrypt structure for the recipient is organized as follows: o At a minimum, headers MUST contain the 'alg' parameter and SHOULD contain a parameter identifying the recipient's asymmetric key. o The headers SHOULD identify the sender's key for the static-static versions and MUST contain the sender's ephemeral key for the ephemeral-static versions. -13.5. Key Agreement with Key Wrap +9.5.5. Key Agreement with Key Wrap Key Agreement with Key Wrap uses a randomly generated CEK. The CEK is then encrypted using a key wrap algorithm and a key derived from the shared secret computed by the key agreement algorithm. The function for this would be: encryptedKey = KeyWrap(KDF(DH-Shared, context), CEK) The COSE_Encrypt structure for the recipient is organized as follows: o The 'protected' field is fed into the KDF context structure. o The plaintext to be encrypted is the key from the next layer down (usually the content layer). o The 'alg' parameter MUST be present in the layer. o A parameter identifying the recipient's key SHOULD be present. A parameter identifying the sender's key SHOULD be present. -14. CBOR Encoding Restrictions +10. CBOR Encoding Restrictions There has been an attempt to limit the number of places where the document needs to impose restrictions on how the CBOR Encoder needs to work. We have managed to narrow it down to the following restrictions: o The restriction applies to the encoding of the Sig_structure, the Enc_structure, and the MAC_structure. - o Encoding MUST be done using definite lengths and the length of the - MUST be the minimum possible length. This means that the integer - 1 is encoded as "0x01" and not "0x1801". + o Encoding MUST be done using definite lengths and values MUST be + the minimum possible length. This means that the integer 1 is + encoded as "0x01" and not "0x1801". o Applications MUST NOT generate messages with the same label used twice as a key in a single map. Applications MUST NOT parse and process messages with the same label used twice as a key in a single map. Applications can enforce the parse and process requirement by using parsers that will fail the parse step or by using parsers that will pass all keys to the application, and the application can perform the check for duplicate keys. -15. Application Profiling Considerations +11. Application Profiling Considerations This document is designed to provide a set of security services, but not impose algorithm implementation requirements for specific usage. The interoperability requirements are provided for how each of the individual services are used and how the algorithms are to be used for interoperability. The requirements about which algorithms and which services are needed are deferred to each application. - An example of a profile can be found in - [I-D.ietf-core-object-security] where a profiles was developed for - carrying content in combination with CoAP headers. + An example of a profile can be found in [RFC8613] where one was + developed for carrying content in combination with CoAP headers. It is intended that a profile of this document be created that defines the interoperability requirements for that specific application. This section provides a set of guidelines and topics that need to be considered when profiling this document. o Applications need to determine the set of messages defined in this document that they will be using. The set of messages corresponds fairly directly to the set of security services that are needed and to the security levels needed. @@ -2107,27 +2144,27 @@ * Advertising in the message (S/MIME capabilities) [RFC5751]. * Advertising in the certificate (capabilities extension) [RFC4262]. * Minimum requirements for the S/MIME, which have been updated over time [RFC2633] [RFC5751] (note that [RFC2633] has been obsoleted by [RFC5751]). -16. IANA Considerations +12. IANA Considerations The registeries and registrations listed below were created during processing of RFC 8152 [RFC8152]. The only known action at this time is to update the references. -16.1. CBOR Tag Assignment +12.1. CBOR Tag Assignment IANA assigned tags in the "CBOR Tags" registry as part of processing [RFC8152]. IANA is requested to update the references from [RFC8152] to this document. IANA is requested to register a new tag for the CounterSignature type. Tag: TBD0 @@ -2125,58 +2162,57 @@ IANA assigned tags in the "CBOR Tags" registry as part of processing [RFC8152]. IANA is requested to update the references from [RFC8152] to this document. IANA is requested to register a new tag for the CounterSignature type. Tag: TBD0 Data Item: COSE_Signature - Semantics: COSE standalone counter signature Reference: [[this document]] -16.2. COSE Header Parameters Registry +12.2. COSE Header Parameters Registry IANA created a registry titled "COSE Header Parameters" as part of processing [RFC8152]. The registry has been created to use the "Expert Review Required" registration procedure [RFC8126]. IANA is requested to update the reference for entries in the table from [RFC8152] to this document. This document does not update the expert review guidelines provided in [RFC8152]. -16.3. COSE Header Algorithm Parameters Registry +12.3. COSE Header Algorithm Parameters Registry IANA created a registry titled "COSE Header Algorithm Parameters" as part of processing [RFC8152]. The registry has been created to use the "Expert Review Required" registration procedure [RFC8126]. IANA is requested to update the references from [RFC8152] to this document. This document does not update the expert review guidelines provided in [RFC8152]. -16.4. COSE Key Common Parameters Registry +12.4. COSE Key Common Parameters Registry IANA created a registry titled "COSE Key Common Parameters" as part of the processing of [RFC8152]. The registry has been created to use the "Expert Review Required" registration procedure [RFC8126]. IANA is requested to update the reference for entries in the table from [RFC8152] to this document. This document does not update the expert review guidelines provided in [RFC8152]. -16.5. Media Type Registrations +12.5. Media Type Registrations -16.5.1. COSE Security Message +12.5.1. COSE Security Message This section registers the 'application/cose' media type in the "Media Types" registry. These media types are used to indicate that the content is a COSE message. Type name: application Subtype name: cose Required parameters: N/A @@ -2213,21 +2248,21 @@ Intended usage: COMMON Restrictions on usage: N/A Author: Jim Schaad, ietf@augustcellars.com Change Controller: IESG Provisional registration? No -16.5.2. COSE Key Media Type +12.5.2. COSE Key Media Type This section registers the 'application/cose-key' and 'application/ cose-key-set' media types in the "Media Types" registry. These media types are used to indicate, respectively, that content is a COSE_Key or COSE_KeySet object. The template for registering 'application/cose-key' is: Type name: application @@ -2312,50 +2348,50 @@ Intended usage: COMMON Restrictions on usage: N/A Author: Jim Schaad, ietf@augustcellars.com Change Controller: IESG Provisional registration? No -16.6. CoAP Content-Formats Registry +12.6. CoAP Content-Formats Registry IANA added the following entries to the "CoAP Content-Formats" registry while processing [RFC8152]. IANA is requested to update the reference value from [RFC8152] to [[This Document]]. -17. Security Considerations +13. Security Considerations There are a number of security considerations that need to be taken into account by implementers of this specification. The security considerations that are specific to an individual algorithm are placed next to the description of the algorithm. While some considerations have been highlighted here, additional considerations may be found in the documents listed in the references. Implementations need to protect the private key material for any - individuals. There are some cases in this document that need to be - highlighted on this issue. + individuals. There are some cases that need to be highlighted on + this issue. o Using the same key for two different algorithms can leak information about the key. It is therefore recommended that keys be restricted to a single algorithm. o Use of 'direct' as a recipient algorithm combined with a second recipient algorithm exposes the direct key to the second recipient. - o Several of the algorithms in this document have limits on the - number of times that a key can be used without leaking information - about the key. + o Several of the algorithms in [I-D.ietf-cose-rfc8152bis-algs] have + limits on the number of times that a key can be used without + leaking information about the key. The use of ECDH and direct plus KDF (with no key wrap) will not directly lead to the private key being leaked; the one way function of the KDF will prevent that. There is, however, a different issue that needs to be addressed. Having two recipients requires that the CEK be shared between two recipients. The second recipient therefore has a CEK that was derived from material that can be used for the weak proof of origin. The second recipient could create a message using the same CEK and send it to the first recipient; the first recipient would, for either static-static ECDH or direct plus KDF, @@ -2379,52 +2415,54 @@ Before using a key for transmission, or before acting on information received, a trust decision on a key needs to be made. Is the data or action something that the entity associated with the key has a right to see or a right to request? A number of factors are associated with this trust decision. Some of the ones that are highlighted here are: o What are the permissions associated with the key owner? o Is the cryptographic algorithm acceptable in the current context? + o Have the restrictions associated with the key, such as algorithm or freshness, been checked and are they correct? o Is the request something that is reasonable, given the current state of the application? o Have any security considerations that are part of the message been enforced (as specified by the application or 'crit' parameter)? - There are a large number of algorithms presented in this document - that use nonce values. For all of the nonces defined in this - document, there is some type of restriction on the nonce being a - unique value either for a key or for some other conditions. In all - of these cases, there is no known requirement on the nonce being both - unique and unpredictable; under these circumstances, it's reasonable - to use a counter for creation of the nonce. In cases where one wants - the pattern of the nonce to be unpredictable as well as unique, one - can use a key created for that purpose and encrypt the counter to - produce the nonce value. + There are a large number of algorithms presented in + [I-D.ietf-cose-rfc8152bis-algs] that use nonce values. Nonces + generally have some type of restriction on their values. Generally a + nonce needs to be a unique value either for a key or for some other + conditions. In all of these cases, there is no known requirement on + the nonce being both unique and unpredictable; under these + circumstances, it's reasonable to use a counter for creation of the + nonce. In cases where one wants the pattern of the nonce to be + unpredictable as well as unique, one can use a key created for that + purpose and encrypt the counter to produce the nonce value. One area that has been starting to get exposure is doing traffic analysis of encrypted messages based on the length of the message. This specification does not provide for a uniform method of providing padding as part of the message structure. An observer can distinguish between two different strings (for example, 'YES' and 'NO') based on the length for all of the content encryption - algorithms that are defined in this document. This means that it is - up to the applications to document how content padding is to be done - in order to prevent or discourage such analysis. (For example, the - strings could be defined as 'YES' and 'NO '.) + algorithms that are defined in [I-D.ietf-cose-rfc8152bis-algs] + document. This means that it is up to the applications to document + how content padding is to be done in order to prevent or discourage + such analysis. (For example, the strings could be defined as 'YES' + and 'NO '.) -18. Implementation Status +14. Implementation Status This section records the status of known implementations of the protocol defined by this specification at the time of posting of this Internet-Draft, and is based on a proposal described in [RFC7942]. The description of implementations in this section is intended to assist the IETF in its decision processes in progressing drafts to RFCs. Please note that the listing of any individual implementation here does not imply endorsement by the IETF. Furthermore, no effort has been spent to verify the information presented here that was supplied by IETF contributors. This is not intended as, and must not @@ -2432,173 +2470,162 @@ features. Readers are advised to note that other implementations may exist. According to [RFC7942], "this will allow reviewers and working groups to assign due consideration to documents that have the benefit of running code, which may serve as evidence of valuable experimentation and feedback that have made the implemented protocols more mature. It is up to the individual working groups to use this information as they see fit". -18.1. Author's Versions +14.1. Author's Versions There are three different implementations that have been created by the author of the document both to create the examples that are included in the document and to validate the structures and methodology used in the design of COSE. Implementation Location: https://github.com/cose-wg Primary Maintainer: Jim Schaad Languages: There are three different languages that are currently supported: Java, C# and C. Cryptography: The Java and C# libraries use Bouncy Castle to provide the required cryptography. The C version uses OPENSSL Version 1.0 for the cryptography. Coverage: The C version currently does not have full countersign - support. THe other two versions do. They do have support to + support. The other two versions do. They do have support to allow for implicit algorithm support as they allow for the application to set attributes that are not to be sent in the message. Testing: All of the examples in the example library are generated by the C# library and then validated using the Java and C libraries. All three libraries have tests to allow for the creating of the same messages that are in the example library followed by validating them. These are not compared against the example library. The Java and C# libraries have unit testing included. Not all of the MUST statements in the document have been implemented as part of the libraries. One such statement is the requirement that unique labels be present. Licensing: Revised BSD License -18.2. Java Script Version +14.2. JavaScript Version Implementation Location: https://github.com/erdtman/cose-js Primary Maintainer: Samuel Erdtman Languages: JavaScript + Cryptography: TBD Coverage: Full Encrypt, Signature and MAC objects are supported. Testing: Basic testing against the common example library. Licensing: Apache License 2.0 -18.3. Python Version +14.3. Python Version Implementation Location: https://github.com/TimothyClaeys/COSE- PYTHON Primary Maintainer: Timothy Claeys Languages: Python Cryptography: pyecdsak, crypto python libraries Coverage: TBD Testing: Basic testing plus running against the common example library. Licensing: BSD 3-Clause License -18.4. COSE Testing Library +14.4. COSE Testing Library Implementation Location: https://github.com/cose-wg/Examples Primary Maintainer: Jim Schaad Description: A set of tests for the COSE library is provided as part of the implementation effort. Both success and fail tests have been provided. All of the examples in this document are part of this example set. Coverage: An attempt has been made to have test cases for every message type and algorithm in the document. Currently examples dealing with counter signatures, and ECDH with Curve24459 and Goldilocks are missing. Licensing: Public Domain -19. References +15. References -19.1. Normative References +15.1. Normative References [COAP.Formats] IANA, "CoAP Content-Formats", . [COSE.Algorithms] IANA, "COSE Algorithms", . [COSE.KeyParameters] IANA, "COSE Key Parameters", . + cose.xhtml#key-common-parameters>. [COSE.KeyTypes] IANA, "COSE Key Types", . + cose.xhtml#key-type>. [DSS] National Institute of Standards and Technology, "Digital Signature Standard (DSS)", FIPS PUB 186-4, DOI 10.6028/NIST.FIPS.186-4, July 2013, . [I-D.ietf-cose-rfc8152bis-algs] Schaad, J., "CBOR Object Signing and Encryption (COSE): - Initial Algorithms", draft-ietf-cose-rfc8152bis-algs-02 - (work in progress), March 2019. + Initial Algorithms", draft-ietf-cose-rfc8152bis-algs-03 + (work in progress), June 2019. [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, . [RFC7049] Bormann, C. and P. Hoffman, "Concise Binary Object Representation (CBOR)", RFC 7049, DOI 10.17487/RFC7049, October 2013, . [RFC8032] Josefsson, S. and I. Liusvaara, "Edwards-Curve Digital Signature Algorithm (EdDSA)", RFC 8032, DOI 10.17487/RFC8032, January 2017, . [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017, . -19.2. Informative References - - [I-D.ietf-cbor-cddl] - Birkholz, H., Vigano, C., and C. Bormann, "Concise data - definition language (CDDL): a notational convention to - express CBOR and JSON data structures", draft-ietf-cbor- - cddl-08 (work in progress), March 2019. - - [I-D.ietf-core-object-security] - Selander, G., Mattsson, J., Palombini, F., and L. Seitz, - "Object Security for Constrained RESTful Environments - (OSCORE)", draft-ietf-core-object-security-16 (work in - progress), March 2019. +15.2. Informative References [PVSig] Brown, D. and D. Johnson, "Formal Security Proofs for a Signature Scheme with Partial Message Recovery", DOI 10.1007/3-540-45353-9_11, LNCS Volume 2020, June 2000. [RFC2633] Ramsdell, B., Ed., "S/MIME Version 3 Message Specification", RFC 2633, DOI 10.17487/RFC2633, June 1999, . [RFC4262] Santesson, S., "X.509 Certificate Extension for Secure/ @@ -2686,20 +2713,31 @@ [RFC8230] Jones, M., "Using RSA Algorithms with CBOR Object Signing and Encryption (COSE) Messages", RFC 8230, DOI 10.17487/RFC8230, September 2017, . [RFC8259] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data Interchange Format", STD 90, RFC 8259, DOI 10.17487/RFC8259, December 2017, . + [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/RFC8610, + June 2019, . + + [RFC8613] Selander, G., Mattsson, J., Palombini, F., and L. Seitz, + "Object Security for Constrained RESTful Environments + (OSCORE)", RFC 8613, DOI 10.17487/RFC8613, July 2019, + . + [W3C.WebCrypto] Watson, M., "Web Cryptography API", W3C Recommendation, January 2017, . Appendix A. Guidelines for External Data Authentication of Algorithms During development of COSE, the requirement that the algorithm identifier be located in the protected attributes was relaxed from a must to a should. There were two basic reasons that have been advanced to support this position. First, the resulting message will @@ -2744,24 +2782,25 @@ should be used, the implicit or the explicit one. This applies even if the transported algorithm identifier is a protected attribute. This applies even if the transported algorithm is the same as the implicit algorithm. o Applications need to define the set of information that is to be considered to be part of a context when omitting algorithm identifiers. At a minimum, this would be the key identifier (if needed), the key, the algorithm, and the COSE structure it is used with. Applications should restrict the use of a single key to a - single algorithm. As noted for some of the algorithms in this - document, the use of the same key in different related algorithms - can lead to leakage of information about the key, leakage about - the data or the ability to perform forgeries. + single algorithm. As noted for some of the algorithms in + [I-D.ietf-cose-rfc8152bis-algs], the use of the same key in + different related algorithms can lead to leakage of information + about the key, leakage about the data or the ability to perform + forgeries. o In many cases, applications that make the algorithm identifier implicit will also want to make the context identifier implicit for the same reason. That is, omitting the context identifier will decrease the message size (potentially significantly depending on the length of the identifier). Applications that do this will need to describe the circumstances where the context identifier is to be omitted and how the context identifier is to be inferred in these cases. (An exhaustive search over all of the keys would normally not be considered to be acceptable.) An @@ -2925,22 +2963,22 @@ ] ] ] ) Appendix C. 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 [I-D.ietf-cbor-cddl]) - rather than as a binary dump. + extended CBOR diagnostic notation (defined in [RFC8610]) rather than + as a binary dump. A GitHub project has been created at that contains not only the examples presented in this document, but a more complete set of testing examples as well. Each example is found in a JSON file that contains the inputs used to create the example, some of the intermediate values that can be used in debugging the example and the output of the example presented in both a hex and a CBOR diagnostic notation format. Some of the examples at the site are designed failure testing cases; these are clearly marked as such in the JSON file. If errors in the examples