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

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