< draft-ietf-cose-rfc8152bis-struct-04.txt   draft-ietf-cose-rfc8152bis-struct-05.txt >
COSE Working Group J. Schaad COSE Working Group J. Schaad
Internet-Draft August Cellars Internet-Draft August Cellars
Obsoletes: 8152 (if approved) August 17, 2019 Obsoletes8152 (if approved) August 18, 2019
Intended status: Standards Track Intended status: Standards Track
Expires: February 18, 2020 Expires: February 19, 2020
CBOR Object Signing and Encryption (COSE): Structures and Process CBOR Object Signing and Encryption (COSE): Structures and Process
draft-ietf-cose-rfc8152bis-struct-04 draft-ietf-cose-rfc8152bis-struct-05
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
represent cryptographic keys using CBOR. represent cryptographic keys using CBOR.
This document along with [I-D.ietf-cose-rfc8152bis-algs] obsoletes This document along with [I-D.ietf-cose-rfc8152bis-algs] obsoletes
RFC8152. RFC8152.
Contributing to this document Contributing to this document
This note is to be removed before publishing as an RFC.
The source for this draft is being maintained in GitHub. Suggested The source for this draft is being maintained in GitHub. Suggested
changes should be submitted as pull requests at <https://github.com/ changes should be submitted as pull requests at https://github.com/
cose-wg/cose-rfc8152bis>. Instructions are on that page as well. cose-wg/cose-rfc8152bis. Instructions are on that page as well.
Editorial changes can be managed in GitHub, but any substantial Editorial changes can be managed in GitHub, but any substantial
issues need to be discussed on the COSE mailing list. issues need to be discussed on the COSE mailing list.
Status of This Memo Status of This Memo
This Internet-Draft is submitted in full conformance with the This Internet-Draft is submitted in full conformance with the
provisions of BCP 78 and BCP 79. provisions of BCP 78 and BCP 79.
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 February 19, 2020.
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/
(https://trustee.ietf.org/license-info) in effect on the date of license-info) in effect on the date of publication of this document.
publication of this document. Please review these documents Please review these documents carefully, as they describe your rights
carefully, as they describe your rights and restrictions with respect and restrictions with respect to this document. Code Components
to this document. Code Components extracted from this document must extracted from this document must include Simplified BSD License text
include Simplified BSD License text as described in Section 4.e of as described in Section 4.e of the Trust Legal Provisions and are
the Trust Legal Provisions and are provided without warranty as 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 . . . . . . . . . . . . . . . . 8 1.5. CBOR-Related Terminology . . . . . . . . . . . . . . . . 8
1.6. Document Terminology . . . . . . . . . . . . . . . . . . 8 1.6. Document Terminology . . . . . . . . . . . . . . . . . . 8
2. Basic COSE Structure . . . . . . . . . . . . . . . . . . . . 9 2. Basic COSE Structure . . . . . . . . . . . . . . . . . . . . 9
3. Header Parameters . . . . . . . . . . . . . . . . . . . . . . 11 3. Header Parameters . . . . . . . . . . . . . . . . . . . . . . 13
3.1. Common COSE Headers Parameters . . . . . . . . . . . . . 13 3.1. Common COSE Headers Parameters . . . . . . . . . . . . . 15
4. Signing Objects . . . . . . . . . . . . . . . . . . . . . . . 17 4. Signing Objects . . . . . . . . . . . . . . . . . . . . . . . 19
4.1. Signing with One or More Signers . . . . . . . . . . . . 17 4.1. Signing with One or More Signers . . . . . . . . . . . . 19
4.2. Signing with One Signer . . . . . . . . . . . . . . . . . 19 4.2. Signing with One Signer . . . . . . . . . . . . . . . . . 21
4.3. Externally Supplied Data . . . . . . . . . . . . . . . . 20 4.3. Externally Supplied Data . . . . . . . . . . . . . . . . 22
4.4. Signing and Verification Process . . . . . . . . . . . . 21 4.4. Signing and Verification Process . . . . . . . . . . . . 23
5. Counter Signatures . . . . . . . . . . . . . . . . . . . . . 22 5. Counter Signatures . . . . . . . . . . . . . . . . . . . . . 25
5.1. Full Countersignatures . . . . . . . . . . . . . . . . . 23 5.1. Full Countersignatures . . . . . . . . . . . . . . . . . 25
5.2. Abbreviated Countersignatures . . . . . . . . . . . . . . 24 5.2. Abbreviated Countersignatures . . . . . . . . . . . . . . 26
6. Encryption Objects . . . . . . . . . . . . . . . . . . . . . 25 6. Encryption Objects . . . . . . . . . . . . . . . . . . . . . 27
6.1. Enveloped COSE Structure . . . . . . . . . . . . . . . . 25 6.1. Enveloped COSE Structure . . . . . . . . . . . . . . . . 27
6.1.1. Content Key Distribution Methods . . . . . . . . . . 27 6.1.1. Content Key Distribution Methods . . . . . . . . . . 29
6.2. Single Recipient Encrypted . . . . . . . . . . . . . . . 27 6.2. Single Recipient Encrypted . . . . . . . . . . . . . . . 29
6.3. How to Encrypt and Decrypt for AEAD Algorithms . . . . . 28 6.3. How to Encrypt and Decrypt for AEAD Algorithms . . . . . 30
6.4. How to Encrypt and Decrypt for AE Algorithms . . . . . . 30 6.4. How to Encrypt and Decrypt for AE Algorithms . . . . . . 32
7. MAC Objects . . . . . . . . . . . . . . . . . . . . . . . . . 31 7. MAC Objects . . . . . . . . . . . . . . . . . . . . . . . . . 34
7.1. MACed Message with Recipients . . . . . . . . . . . . . . 32 7.1. MACed Message with Recipients . . . . . . . . . . . . . . 34
7.2. MACed Messages with Implicit Key . . . . . . . . . . . . 33 7.2. MACed Messages with Implicit Key . . . . . . . . . . . . 35
7.3. How to Compute and Verify a MAC . . . . . . . . . . . . . 34 7.3. How to Compute and Verify a MAC . . . . . . . . . . . . . 36
8. Key Objects . . . . . . . . . . . . . . . . . . . . . . . . . 35 8. Key Objects . . . . . . . . . . . . . . . . . . . . . . . . . 38
8.1. COSE Key Common Parameters . . . . . . . . . . . . . . . 36 8.1. COSE Key Common Parameters . . . . . . . . . . . . . . . 38
9. Taxonomy of Algorithms used by COSE . . . . . . . . . . . . . 38
9.1. Signature Algorithms . . . . . . . . . . . . . . . . . . 38 9. Taxonomy of Algorithms used by COSE . . . . . . . . . . . . . 41
9.2. Message Authentication Code (MAC) Algorithms . . . . . . 39 9.1. Signature Algorithms . . . . . . . . . . . . . . . . . . 42
9.3. Content Encryption Algorithms . . . . . . . . . . . . . . 40 9.2. Message Authentication Code (MAC) Algorithms . . . . . . 43
9.4. Key Derivation Functions (KDFs) . . . . . . . . . . . . . 41 9.3. Content Encryption Algorithms . . . . . . . . . . . . . . 43
9.5. Content Key Distribution Methods . . . . . . . . . . . . 41 9.4. Key Derivation Functions (KDFs) . . . . . . . . . . . . . 44
9.5.1. Direct Encryption . . . . . . . . . . . . . . . . . . 41 9.5. Content Key Distribution Methods . . . . . . . . . . . . 44
9.5.2. Key Wrap . . . . . . . . . . . . . . . . . . . . . . 42 9.5.1. Direct Encryption . . . . . . . . . . . . . . . . . . 45
9.5.3. Key Transport . . . . . . . . . . . . . . . . . . . . 43 9.5.2. Key Wrap . . . . . . . . . . . . . . . . . . . . . . 45
9.5.4. Direct Key Agreement . . . . . . . . . . . . . . . . 43 9.5.3. Key Transport . . . . . . . . . . . . . . . . . . . . 46
9.5.5. Key Agreement with Key Wrap . . . . . . . . . . . . . 44 9.5.4. Direct Key Agreement . . . . . . . . . . . . . . . . 46
10. CBOR Encoding Restrictions . . . . . . . . . . . . . . . . . 44 9.5.5. Key Agreement with Key Wrap . . . . . . . . . . . . . 47
11. Application Profiling Considerations . . . . . . . . . . . . 45 10. CBOR Encoding Restrictions . . . . . . . . . . . . . . . . . 48
12. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 46 11. Application Profiling Considerations . . . . . . . . . . . . 48
12.1. CBOR Tag Assignment . . . . . . . . . . . . . . . . . . 46 12. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 49
12.2. COSE Header Parameters Registry . . . . . . . . . . . . 47 12.1. CBOR Tag Assignment . . . . . . . . . . . . . . . . . . 50
12.3. COSE Header Algorithm Parameters Registry . . . . . . . 47 12.2. COSE Header Parameters Registry . . . . . . . . . . . . 50
12.4. COSE Key Common Parameters Registry . . . . . . . . . . 47 12.3. COSE Header Algorithm Parameters Registry . . . . . . . 50
12.5. Media Type Registrations . . . . . . . . . . . . . . . . 47 12.4. COSE Key Common Parameters Registry . . . . . . . . . . 50
12.5.1. COSE Security Message . . . . . . . . . . . . . . . 47 12.5. Media Type Registrations . . . . . . . . . . . . . . . . 51
12.5.2. COSE Key Media Type . . . . . . . . . . . . . . . . 48 12.5.1. COSE Security Message . . . . . . . . . . . . . . . 51
12.6. CoAP Content-Formats Registry . . . . . . . . . . . . . 50 12.5.2. COSE Key Media Type . . . . . . . . . . . . . . . . 52
13. Security Considerations . . . . . . . . . . . . . . . . . . . 51 12.6. CoAP Content-Formats Registry . . . . . . . . . . . . . 54
14. Implementation Status . . . . . . . . . . . . . . . . . . . . 53 13. Security Considerations . . . . . . . . . . . . . . . . . . . 54
14.1. Author's Versions . . . . . . . . . . . . . . . . . . . 53 14. Implementation Status . . . . . . . . . . . . . . . . . . . . 56
14.2. JavaScript Version . . . . . . . . . . . . . . . . . . . 54 14.1. Author's Versions . . . . . . . . . . . . . . . . . . . 56
14.3. Python Version . . . . . . . . . . . . . . . . . . . . . 54 14.2. JavaScript Version . . . . . . . . . . . . . . . . . . . 57
14.4. COSE Testing Library . . . . . . . . . . . . . . . . . . 55 14.3. Python Version . . . . . . . . . . . . . . . . . . . . . 57
15. References . . . . . . . . . . . . . . . . . . . . . . . . . 55 14.4. COSE Testing Library . . . . . . . . . . . . . . . . . . 58
15.1. Normative References . . . . . . . . . . . . . . . . . . 55 15. References . . . . . . . . . . . . . . . . . . . . . . . . . 58
15.2. Informative References . . . . . . . . . . . . . . . . . 56 15.1. Normative References . . . . . . . . . . . . . . . . . . 58
15.2. Informative References . . . . . . . . . . . . . . . . . 59
Appendix A. Guidelines for External Data Authentication of Appendix A. Guidelines for External Data Authentication of
Algorithms . . . . . . . . . . . . . . . . . . . . . 59 Algorithms . . . . . . . . . . . . . . . . . . . . . . . 62
Appendix B. Two Layers of Recipient Information . . . . . . . . 62 Appendix B. Two Layers of Recipient Information . . . . . . . . 65
Appendix C. Examples . . . . . . . . . . . . . . . . . . . . . . 63 Appendix C. Examples . . . . . . . . . . . . . . . . . . . . . . 67
C.1. Examples of Signed Messages . . . . . . . . . . . . . . . 64 C.1. Examples of Signed Messages . . . . . . . . . . . . . . . 67
C.1.1. Single Signature . . . . . . . . . . . . . . . . . . 64 C.1.1. Single Signature . . . . . . . . . . . . . . . . . . 67
C.1.2. Multiple Signers . . . . . . . . . . . . . . . . . . 65 C.1.2. Multiple Signers . . . . . . . . . . . . . . . . . . 68
C.1.3. Counter Signature . . . . . . . . . . . . . . . . . . 66 C.1.3. Counter Signature . . . . . . . . . . . . . . . . . . 69
C.1.4. Signature with Criticality . . . . . . . . . . . . . 67 C.1.4. Signature with Criticality . . . . . . . . . . . . . 70
C.2. Single Signer Examples . . . . . . . . . . . . . . . . . 68 C.2. Single Signer Examples . . . . . . . . . . . . . . . . . 71
C.2.1. Single ECDSA Signature . . . . . . . . . . . . . . . 68 C.2.1. Single ECDSA Signature . . . . . . . . . . . . . . . 71
C.3. Examples of Enveloped Messages . . . . . . . . . . . . . 69 C.3. Examples of Enveloped Messages . . . . . . . . . . . . . 72
C.3.1. Direct ECDH . . . . . . . . . . . . . . . . . . . . . 69 C.3.1. Direct ECDH . . . . . . . . . . . . . . . . . . . . . 72
C.3.2. Direct Plus Key Derivation . . . . . . . . . . . . . 70 C.3.2. Direct Plus Key Derivation . . . . . . . . . . . . . 73
C.3.3. Counter Signature on Encrypted Content . . . . . . . 71 C.3.3. Counter Signature on Encrypted Content . . . . . . . 74
C.3.4. Encrypted Content with External Data . . . . . . . . 73 C.3.4. Encrypted Content with External Data . . . . . . . . 75
C.4. Examples of Encrypted Messages . . . . . . . . . . . . . 73 C.4. Examples of Encrypted Messages . . . . . . . . . . . . . 76
C.4.1. Simple Encrypted Message . . . . . . . . . . . . . . 73 C.4.1. Simple Encrypted Message . . . . . . . . . . . . . . 76
C.4.2. Encrypted Message with a Partial IV . . . . . . . . . 74 C.4.2. Encrypted Message with a Partial IV . . . . . . . . . 77
C.5. Examples of MACed Messages . . . . . . . . . . . . . . . 74 C.5. Examples of MACed Messages . . . . . . . . . . . . . . . 77
C.5.1. Shared Secret Direct MAC . . . . . . . . . . . . . . 74 C.5.1. Shared Secret Direct MAC . . . . . . . . . . . . . . 77
C.5.2. ECDH Direct MAC . . . . . . . . . . . . . . . . . . . 75 C.5.2. ECDH Direct MAC . . . . . . . . . . . . . . . . . . . 78
C.5.3. Wrapped MAC . . . . . . . . . . . . . . . . . . . . . 76 C.5.3. Wrapped MAC . . . . . . . . . . . . . . . . . . . . . 79
C.5.4. Multi-Recipient MACed Message . . . . . . . . . . . . 77 C.5.4. Multi-Recipient MACed Message . . . . . . . . . . . . 80
C.6. Examples of MAC0 Messages . . . . . . . . . . . . . . . . 78 C.6. Examples of MAC0 Messages . . . . . . . . . . . . . . . . 81
C.6.1. Shared Secret Direct MAC . . . . . . . . . . . . . . 78 C.6.1. Shared Secret Direct MAC . . . . . . . . . . . . . . 81
C.7. COSE Keys . . . . . . . . . . . . . . . . . . . . . . . . 79 C.7. COSE Keys . . . . . . . . . . . . . . . . . . . . . . . . 82
C.7.1. Public Keys . . . . . . . . . . . . . . . . . . . . . 79 C.7.1. Public Keys . . . . . . . . . . . . . . . . . . . . . 82
C.7.2. Private Keys . . . . . . . . . . . . . . . . . . . . 80 C.7.2. Private Keys . . . . . . . . . . . . . . . . . . . . 83
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 82 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 85
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 83 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 86
1. Introduction 1. Introduction
There has been an increased focus on small, constrained devices that There has been an increased focus on small, constrained devices that
make up the Internet of Things (IoT). One of the standards that has make up the Internet of Things (IoT). One of the standards that has
come out of this process is "Concise Binary Object Representation come out of this process is "Concise Binary Object Representation
(CBOR)" [RFC7049]. CBOR extended the data model of the JavaScript (CBOR)" [RFC7049]. CBOR extended the data model of the JavaScript
Object Notation (JSON) [RFC8259] by allowing for binary data, among Object Notation (JSON) [RFC8259] by allowing for binary data, among
other changes. CBOR has been adopted by several of the IETF working other changes. CBOR has been adopted by several of the IETF working
groups dealing with the IoT world as their encoding of data groups dealing with the IoT world as their encoding of data
skipping to change at page 4, line 42 skipping to change at page 4, line 43
The JOSE working group produced a set of documents [RFC7515] The JOSE working group produced a set of documents [RFC7515]
[RFC7516] [RFC7517] [RFC7518] using JSON that specified how to [RFC7516] [RFC7517] [RFC7518] using JSON that specified how to
process encryption, signatures, and Message Authentication Code (MAC) process encryption, signatures, and Message Authentication Code (MAC)
operations and how to encode keys using JSON. This document along operations and how to encode keys using JSON. This document along
with [I-D.ietf-cose-rfc8152bis-algs] defines the CBOR Object Signing with [I-D.ietf-cose-rfc8152bis-algs] defines the CBOR Object Signing
and Encryption (COSE) standard, which does the same thing for the and Encryption (COSE) standard, which does the same thing for the
CBOR encoding format. While there is a strong attempt to keep the CBOR encoding format. While there is a strong attempt to keep the
flavor of the original JSON Object Signing and Encryption (JOSE) flavor of the original JSON Object Signing and Encryption (JOSE)
documents, two considerations are taken into account: documents, two considerations are taken into account:
o CBOR has capabilities that are not present in JSON and are * CBOR has capabilities that are not present in JSON and are
appropriate to use. One example of this is the fact that CBOR has appropriate to use. One example of this is the fact that CBOR has
a method of encoding binary directly without first converting it a method of encoding binary directly without first converting it
into a base64-encoded string. into a base64-encoded string.
o COSE is not a direct copy of the JOSE specification. In the * COSE is not a direct copy of the JOSE specification. In the
process of creating COSE, decisions that were made for JOSE were process of creating COSE, decisions that were made for JOSE were
re-examined. In many cases, different results were decided on as re-examined. In many cases, different results were decided on as
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 * 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 build the inputs to the cryptographic * The procedures used to build the inputs to the 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 * 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.
skipping to change at page 5, line 39 skipping to change at page 5, line 39
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 define 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, * 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.
o Signed messages distinguish between the protected and unprotected * Signed messages distinguish between the protected and unprotected
parameters that relate to the content from those that relate to parameters that relate to the content from those that relate to
the signature. the signature.
o MACed messages are separated from signed messages. * MACed messages are separated from signed messages.
o MACed messages have the ability to use the same set of recipient * MACed messages have the ability to use the same set of recipient
algorithms as enveloped messages for obtaining the MAC algorithms as enveloped messages for obtaining the MAC
authentication key. authentication key.
o Use binary encodings for binary data rather than base64url * Use binary encodings for binary data rather than base64url
encodings. encodings.
o Combine the authentication tag for encryption algorithms with the * Combine the authentication tag for encryption algorithms with the
ciphertext. ciphertext.
o The set of cryptographic algorithms has been expanded in some * The set of cryptographic algorithms has been expanded in some
directions and trimmed in others. directions and trimmed in others.
1.2. Changes from RFC8152 1.2. Changes from RFC8152
o Split the orignal document into this document and * 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 * 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 * Rearrange the text around counter signatures and define a CBOR Tag
for a standalone 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.
skipping to change at page 10, line 22 skipping to change at page 11, line 5
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 | | 98 | cose-sign | COSE_Sign | COSE Signed |
| | | | Data Object | | | | | Data Object |
| 18 | cose-sign1 | COSE_Sign1 | COSE Single | +------+------------------+-----------------------+-------------+
| | | | Signer Data | | 18 | cose-sign1 | COSE_Sign1 | COSE Single |
| | | | Object | | | | | Signer Data |
| 96 | cose-encrypt | COSE_Encrypt | COSE Encrypted | | | | | Object |
| | | | Data Object | +------+------------------+-----------------------+-------------+
| 16 | cose-encrypt0 | COSE_Encrypt0 | COSE Single | | 96 | cose-encrypt | COSE_Encrypt | COSE |
| | | | Recipient | | | | | Encrypted |
| | | | Encrypted Data | | | | | Data Object |
| | | | Object | +------+------------------+-----------------------+-------------+
| 97 | cose-mac | COSE_Mac | COSE MACed Data | | 16 | cose-encrypt0 | COSE_Encrypt0 | COSE Single |
| | | | Object | | | | | Recipient |
| 17 | cose-mac0 | COSE_Mac0 | COSE Mac w/o | | | | | Encrypted |
| | | | Recipients | | | | | Data Object |
| | | | Object | +------+------------------+-----------------------+-------------+
| TBD0 | cose-countersign | COSE_Countersignature | COSE standalone | | 97 | cose-mac | COSE_Mac | COSE MACed |
| | | | counter | | | | | Data Object |
| | | | 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 | | 98 | [[THIS | | application/cose; cose- | | 98 | [[THIS |
| ="cose-sign" | | | DOCUMENT]] | | type="cose-sign" | | | DOCUMENT]] |
| application/cose; cose-type | | 18 | [[THIS | +---------------------------+----------+-----+------------+
| ="cose-sign1" | | | DOCUMENT]] | | application/cose; cose- | | 18 | [[THIS |
| application/cose; cose-type | | 96 | [[THIS | | type="cose-sign1" | | | DOCUMENT]] |
| ="cose-encrypt" | | | DOCUMENT]] | +---------------------------+----------+-----+------------+
| application/cose; cose-type | | 16 | [[THIS | | application/cose; cose- | | 96 | [[THIS |
| ="cose-encrypt0" | | | DOCUMENT]] | | type="cose-encrypt" | | | DOCUMENT]] |
| application/cose; cose-type | | 97 | [[THIS | +---------------------------+----------+-----+------------+
| ="cose-mac" | | | DOCUMENT]] | | application/cose; cose- | | 16 | [[THIS |
| application/cose; cose-type | | 17 | [[THIS | | type="cose-encrypt0" | | | DOCUMENT]] |
| ="cose-mac0" | | | DOCUMENT]] | +---------------------------+----------+-----+------------+
| application/cose-key | | 101 | [[THIS | | application/cose; cose- | | 97 | [[THIS |
| | | | DOCUMENT]] | | type="cose-mac" | | | DOCUMENT]] |
| application/cose-key-set | | 102 | [[THIS | +---------------------------+----------+-----+------------+
| | | | DOCUMENT]] | | application/cose; cose- | | 17 | [[THIS |
+----------------------------------+----------+-----+---------------+ | type="cose-mac0" | | | DOCUMENT]] |
+---------------------------+----------+-----+------------+
| application/cose-key | | 101 | [[THIS |
| | | | 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 /
COSE_Encrypt / COSE_Encrypt0 / COSE_Encrypt / COSE_Encrypt0 /
COSE_Mac / COSE_Mac0 / COSE_Countersignature COSE_Mac / COSE_Mac0 / COSE_Countersignature
skipping to change at page 12, line 18 skipping to change at page 13, line 29
(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 12.2). (Section 12.2).
The two buckets are: 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
not going to be included in a cryptographic computation. This if it is not going to be included in a cryptographic
bucket is encoded in the message as a binary object. This value computation. This bucket is encoded in the message as
is obtained by CBOR encoding the protected map and wrapping it in a binary object. This value is obtained by CBOR
a bstr object. Senders SHOULD encode a zero-length map as a zero- encoding the protected map and wrapping it in a bstr
length byte string rather than as a zero-length map (encoded as object. Senders SHOULD encode a zero-length map as a
h'a0'). The zero-length binary encoding is preferred because it zero-length byte string rather than as a zero-length
is both shorter and the version used in the serialization map (encoded as h'a0'). The zero-length binary
structures for cryptographic computation. After encoding the map, encoding is preferred because it is both shorter and
the value is wrapped in the binary object. Recipients MUST accept the version used in the serialization structures for
both a zero-length binary value and a zero-length map encoded in cryptographic computation. After encoding the map, the
the binary value. The wrapping allows for the encoding of the value is wrapped in the binary object. Recipients MUST
protected map to be transported with a greater chance that it will accept both a zero-length binary value and a zero-
not be altered in transit. (Badly behaved intermediates could length map encoded in the binary value. The wrapping
decode and re-encode, but this will result in a failure to verify allows for the encoding of the protected map to be
unless the re-encoded byte string is identical to the decoded byte transported with a greater chance that it will not be
string.) This avoids the problem of all parties needing to be altered in transit. (Badly behaved intermediates could
able to do a common canonical encoding. decode and re-encode, but this will result in a failure
to verify unless the re-encoded byte string is
identical to the decoded byte string.) This avoids the
problem of all parties needing to be able to do a
common canonical encoding.
unprotected: Contains parameters about the current layer that are unprotected: Contains parameters about the current layer that are
not cryptographically protected. not cryptographically protected.
Only parameters that deal with the current layer are to be placed at Only parameters that deal with the current layer are to be placed at
that layer. As an example of this, the parameter 'content type' that layer. As an example of this, the parameter 'content type'
describes the content of the message being carried in the message. describes the content of the message being carried in the message.
As such, this parameter is placed only in the content layer and is As such, this parameter is placed only in the content layer and is
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.
skipping to change at page 13, line 44 skipping to change at page 15, line 13
empty_or_serialized_map = bstr .cbor header_map / bstr .size 0 empty_or_serialized_map = bstr .cbor header_map / bstr .size 0
3.1. Common COSE Headers Parameters 3.1. Common COSE Headers Parameters
This section defines a set of common header parameters. A summary of This section defines a set of common header parameters. A summary of
these parameters can be found in Table 3. This table should be these parameters can be found in Table 3. This table should be
consulted to determine the value of label and the type of the value. consulted to determine the value of label and the type of the value.
The set of header parameters defined in this section are: The set of header parameters defined in this section are:
alg: This parameter is used to indicate the algorithm used for the alg: This parameter is used to indicate the algorithm
security processing. This parameter MUST be authenticated where used for the security processing. This parameter
the ability to do so exists. This support is provided by AEAD MUST be authenticated where the ability to do so
algorithms or construction (COSE_Sign, COSE_Sign1, COSE_Mac, and exists. This support is provided by AEAD
COSE_Mac0). This authentication can be done either by placing the algorithms or construction (COSE_Sign,
parameter in the protected header bucket or as part of the COSE_Sign1, COSE_Mac, and COSE_Mac0). This
externally supplied data. The value is taken from the "COSE authentication can be done either by placing the
Algorithms" registry (see [COSE.Algorithms]). parameter in the protected header bucket or as
part of the externally supplied data. The value
is taken from the "COSE Algorithms" registry (see
[COSE.Algorithms]).
crit: The parameter is used to indicate which protected header crit: The parameter is used to indicate which protected
labels an application that is processing a message is required to header labels an application that is processing a
understand. Parameters defined in this document do not need to be message is required to understand. Parameters
included as they should be understood by all implementations. defined in this document do not need to be
When present, this parameter MUST be placed in the protected included as they should be understood by all
header bucket. The array MUST have at least one value in it. implementations. When present, this parameter
Not all labels need to be included in the 'crit' parameter. The MUST be placed in the protected header bucket.
rules for deciding which header labels are placed in the array The array MUST have at least one value in it.
are:
* Integer labels in the range of 0 to 7 SHOULD be omitted. Not all labels need to be included in the 'crit'
parameter. The rules for deciding which header
labels are placed in the array are:
* Integer labels in the range -1 to -128 can be omitted as they * Integer labels in the range of 0 to 7 SHOULD
are algorithm dependent. If an application can correctly be omitted.
process an algorithm, it can be assumed that it will correctly
process all of the common parameters associated with that
algorithm. Integer labels in the range -129 to -65536 SHOULD
be included as these would be less common parameters that might
not be generally supported.
* Labels for parameters required for an application MAY be * Integer labels in the range -1 to -128 can be
omitted. Applications should have a statement if the label can omitted as they are algorithm dependent. If
be omitted. an application can correctly process an
algorithm, it can be assumed that it will
correctly process all of the common parameters
associated with that algorithm. Integer
labels in the range -129 to -65536 SHOULD be
included as these would be less common
parameters that might not be generally
supported.
The header parameter values indicated by 'crit' can be processed * Labels for parameters required for an
by either the security library code or an application using a application MAY be omitted. Applications
security library; the only requirement is that the parameter is should have a statement if the label can be
processed. If the 'crit' value list includes a value for which omitted.
the parameter is not in the protected bucket, this is a fatal
error in processing the message.
content type: This parameter is used to indicate the content type of The header parameter values indicated by 'crit'
the data in the payload or ciphertext fields. Integers are from can be processed by either the security library
the "CoAP Content-Formats" IANA registry table [COAP.Formats]. code or an application using a security library;
Text values following the syntax of "<type-name>/<subtype-name>" the only requirement is that the parameter is
where <type-name> and <subtype-name> are defined in Section 4.2 of processed. If the 'crit' value list includes a
[RFC6838]. Leading and trailing whitespace is also omitted. value for which the parameter is not in the
Textual content values along with parameters and subparameters can protected bucket, this is a fatal error in
be located using the IANA "Media Types" registry. Applications processing the message.
SHOULD provide this parameter if the content structure is
potentially ambiguous.
kid: This parameter identifies one piece of data that can be used as content type: This parameter is used to indicate the content
input to find the needed cryptographic key. The value of this type of the data in the payload or ciphertext
parameter can be matched against the 'kid' member in a COSE_Key fields. Integers are from the "CoAP Content-
structure. Other methods of key distribution can define an Formats" IANA registry table [COAP.Formats].
equivalent field to be matched. Applications MUST NOT assume that Text values following the syntax of "<type-
'kid' values are unique. There may be more than one key with the name>/<subtype-name>" where <type-name> and
same 'kid' value, so all of the keys associated with this 'kid' <subtype-name> are defined in Section 4.2 of
may need to be checked. The internal structure of 'kid' values is [RFC6838]. Leading and trailing whitespace is
not defined and cannot be relied on by applications. Key also omitted. Textual content values along with
identifier values are hints about which key to use. This is not a parameters and subparameters can be located using
security-critical field. For this reason, it can be placed in the the IANA "Media Types" registry. Applications
unprotected headers bucket. SHOULD provide this parameter if the content
structure is potentially ambiguous.
IV: This parameter holds the Initialization Vector (IV) value. For kid: This parameter identifies one piece of data that
some symmetric encryption algorithms, this may be referred to as a can be used as input to find the needed
nonce. The IV can be placed in the unprotected header as cryptographic key. The value of this parameter
modifying the IV will cause the decryption to yield plaintext that can be matched against the 'kid' member in a
is readily detectable as garbled. COSE_Key structure. Other methods of key
distribution can define an equivalent field to be
matched. Applications MUST NOT assume that 'kid'
values are unique. There may be more than one
key with the same 'kid' value, so all of the keys
associated with this 'kid' may need to be
checked. The internal structure of 'kid' values
is not defined and cannot be relied on by
applications. Key identifier values are hints
about which key to use. This is not a security-
critical field. For this reason, it can be
placed in the unprotected headers bucket.
Partial IV: This parameter holds a part of the IV value. When using IV: This parameter holds the Initialization Vector
the COSE_Encrypt0 structure, a portion of the IV can be part of (IV) value. For some symmetric encryption
the context associated with the key (Context IV) while a portion algorithms, this may be referred to as a nonce.
can be changed with each message (Parital IV). This field is used The IV can be placed in the unprotected header as
to carry a value that causes the IV to be changed for each modifying the IV will cause the decryption to
message. The Parital IV can be placed in the unprotected header yield plaintext that is readily detectable as
as modifying the value will cause the decryption to yield garbled.
plaintext that is readily detectable as garbled. The
'Initialization Vector' and 'Partial Initialization Vector'
parameters MUST NOT both be present in the same security layer.
The message IV is generated by the following steps: Partial IV: This parameter holds a part of the IV value.
When using the COSE_Encrypt0 structure, a portion
of the IV can be part of the context associated
with the key (Context IV) while a portion can be
changed with each message (Parital IV). This
field is used to carry a value that causes the IV
to be changed for each message. The Parital IV
can be placed in the unprotected header as
modifying the value will cause the decryption to
yield plaintext that is readily detectable as
garbled. The 'Initialization Vector' and
'Partial Initialization Vector' parameters MUST
NOT both be present in the same security layer.
1. Left-pad the Partial IV with zeros to the length of IV. The message IV is generated by the following
steps:
2. XOR the padded Partial IV with the context IV. 1. Left-pad the Partial IV with zeros to the
length of IV.
2. XOR the padded Partial IV with the context
IV.
counter signature: This parameter holds one or more counter 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
second party sign some data. The counter signature parameter can method of having a second party sign some data.
occur as an unprotected attribute in any of the following The counter signature parameter can occur as an
structures: COSE_Sign1, COSE_Signature, COSE_Encrypt, unprotected attribute in any of the following
COSE_recipient, COSE_Encrypt0, COSE_Mac, and COSE_Mac0. These structures: COSE_Sign1, COSE_Signature,
structures all have the same beginning elements, so that a COSE_Encrypt, COSE_recipient, COSE_Encrypt0,
consistent calculation of the counter signature can be computed. COSE_Mac, and COSE_Mac0. These structures all
Details on counter signatures are found in Section 5. have the same beginning elements, so that a
consistent calculation of the counter signature
can be computed. Details on counter signatures
are found in Section 5.
+-----------+-------+----------------+-------------+----------------+ +---------+-----+----------------+-----------------+----------------+
| Name | Label | Value Type | Value | Description | |Name |Label| Value Type | Value Registry | Description |
| | | | Registry | | +=========+=====+================+=================+================+
+-----------+-------+----------------+-------------+----------------+ |alg |1 | int / tstr | COSE Algorithms | Cryptographic |
| alg | 1 | int / tstr | COSE | Cryptographic | | | | | registry | algorithm to use |
| | | | Algorithms | algorithm to | +---------+-----+----------------+-----------------+----------------+
| | | | registry | use | |crit |2 | [+ label] | COSE Header | Critical headers |
| crit | 2 | [+ label] | COSE Header | Critical | | | | | Parameters | to be understood |
| | | | Parameters | headers to be | | | | | registry | |
| | | | registry | understood | +---------+-----+----------------+-----------------+----------------+
| content | 3 | tstr / uint | CoAP | Content type | |content |3 | tstr / uint | CoAP Content- | Content type of |
| type | | | Content- | of the payload | |type | | | Formats or Media | the payload |
| | | | Formats or | | | | | | Types registries | |
| | | | Media Types | | +---------+-----+----------------+-----------------+----------------+
| | | | registries | | |kid |4 | bstr | | Key identifier |
| kid | 4 | bstr | | Key identifier | +---------+-----+----------------+-----------------+----------------+
| IV | 5 | bstr | | Full | |IV |5 | bstr | | Full |
| | | | | Initialization | | | | | | Initialization |
| | | | | Vector | | | | | | Vector |
| Partial | 6 | bstr | | Partial | +---------+-----+----------------+-----------------+----------------+
| IV | | | | Initialization | |Partial |6 | bstr | | Partial |
| | | | | Vector | |IV | | | | Initialization |
| counter | 7 | COSE_Signature | | CBOR-encoded | | | | | | Vector |
| signature | | / [+ | | signature | +---------+-----+----------------+-----------------+----------------+
| | | COSE_Signature | | structure | |counter |7 | COSE_Signature / | | CBOR-encoded |
| | | ] | | | |signature| | [+ | | signature |
+-----------+-------+----------------+-------------+----------------+ | | | COSE_Signature ] | | structure |
+---------+-----+----------------+-----------------+----------------+
Table 3: Common Header Parameters Table 3: Common Header Parameters
The CDDL fragment that represents the set of headers defined in this The CDDL fragment that represents the set of headers defined in this
section is given below. Each of the headers is tagged as optional section is given below. Each of the headers is tagged as optional
because they do not need to be in every map; headers required in because they do not need to be in every map; headers required in
specific maps are discussed above. specific maps are discussed above.
Generic_Headers = ( Generic_Headers = (
? 1 => int / tstr, ; algorithm identifier ? 1 => int / tstr, ; algorithm identifier
skipping to change at page 17, line 27 skipping to change at page 19, line 27
applied to a message payload. Parameters relating to the content and applied to a message payload. Parameters relating to the content and
parameters relating to the signature are carried along with the parameters relating to the signature are carried along with the
signature itself. These parameters may be authenticated by the signature itself. These parameters may be authenticated by the
signature, or just present. An example of a parameter about the signature, or just present. An example of a parameter about the
content is the content type. Examples of parameters about the content is the content type. Examples of parameters about the
signature would be the algorithm and key used to create the signature signature would be the algorithm and key used to create the signature
and counter signatures. and counter signatures.
RFC 5652 indicates that: RFC 5652 indicates that:
When more than one signature is present, the successful validation | When more than one signature is present, the successful validation
of one signature associated with a given signer is usually treated | of one signature associated with a given signer is usually treated
as a successful signature by that signer. However, there are some | as a successful signature by that signer. However, there are some
application environments where other rules are needed. An | application environments where other rules are needed. An
application that employs a rule other than one valid signature for | application that employs a rule other than one valid signature for
each signer must specify those rules. Also, where simple matching | each signer must specify those rules. Also, where simple matching
of the signer identifier is not sufficient to determine whether | of the signer identifier is not sufficient to determine whether
the signatures were generated by the same signer, the application | the signatures were generated by the same signer, the application
specification must describe how to determine which signatures were | specification must describe how to determine which signatures were
generated by the same signer. Support for different communities | generated by the same signer. Support for different communities
of recipients is the primary reason that signers choose to include | of recipients is the primary reason that signers choose to include
more than one signature. | more than one signature.
For example, the COSE_Sign structure might include signatures For example, the COSE_Sign structure might include signatures
generated with the Edwards-curve Digital Signature Algorithm (EdDSA) generated with the Edwards-curve Digital Signature Algorithm (EdDSA)
[RFC8032] and with the Elliptic Curve Digital Signature Algorithm [RFC8032] and with the Elliptic Curve Digital Signature Algorithm
(ECDSA) [DSS]. This allows recipients to verify the signature (ECDSA) [DSS]. This allows recipients to verify the signature
associated with one algorithm or the other. More-detailed associated with one algorithm or the other. More-detailed
information on multiple signature evaluations can be found in information on multiple signature evaluations can be found in
[RFC5752]. [RFC5752].
The signature structure can be encoded as either tagged or untagged The signature structure can be encoded as either tagged or untagged
skipping to change at page 18, line 12 skipping to change at page 20, line 12
structure is identified by the CBOR tag 98. The CDDL fragment that structure is identified by the CBOR tag 98. The CDDL fragment that
represents this is: represents this is:
COSE_Sign_Tagged = #6.98(COSE_Sign) COSE_Sign_Tagged = #6.98(COSE_Sign)
A COSE Signed Message is defined in two parts. The CBOR object that A COSE Signed Message is defined in two parts. The CBOR object that
carries the body and information about the body is called the carries the body and information about the body is called the
COSE_Sign structure. The CBOR object that carries the signature and COSE_Sign structure. The CBOR object that carries the signature and
information about the signature is called the COSE_Signature information about the signature is called the COSE_Signature
structure. Examples of COSE Signed Messages can be found in structure. Examples of COSE Signed Messages can be found in
Appendix C.1. Section c.1.
The COSE_Sign structure is a CBOR array. The fields of the array in The COSE_Sign structure is a CBOR array. The fields of the array in
order are: order are:
protected: This is as described in Section 3. protected: This is as described in Section 3.
unprotected: This is as described in Section 3. unprotected: This is as described in Section 3.
payload: This field contains the serialized content to be signed. payload: This field contains the serialized content to be
If the payload is not present in the message, the application is signed. If the payload is not present in the message,
required to supply the payload separately. The payload is wrapped the application is required to supply the payload
in a bstr to ensure that it is transported without changes. If separately. The payload is wrapped in a bstr to ensure
the payload is transported separately ("detached content"), then a that it is transported without changes. If the payload
nil CBOR object is placed in this location, and it is the is transported separately ("detached content"), then a
responsibility of the application to ensure that it will be nil CBOR object is placed in this location, and it is
transported without changes. the responsibility of the application to ensure that it
will be transported without changes.
Note: When a signature with a message recovery algorithm is used Note: When a signature with a message recovery
(Section 9.1), the maximum number of bytes that can be recovered algorithm is used (Section 9.1), the maximum number of
is the length of the payload. The size of the payload is reduced bytes that can be recovered is the length of the
by the number of bytes that will be recovered. If all of the payload. The size of the payload is reduced by the
bytes of the payload are consumed, then the payload is encoded as number of bytes that will be recovered. If all of the
a zero-length binary string rather than as being absent. bytes of the payload are consumed, then the payload is
encoded as a zero-length binary string rather than as
being absent.
signatures: This field is an array of signatures. Each signature is signatures: This field is an array of signatures. Each signature
represented as a COSE_Signature structure. is 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,
signatures : [+ COSE_Signature] signatures : [+ COSE_Signature]
] ]
The COSE_Signature structure is a CBOR array. The fields of the The COSE_Signature structure is a CBOR array. The fields of the
array in order are: array in order are:
protected: This is as described in Section 3. protected: This is as described in Section 3.
unprotected: This is as described in Section 3. unprotected: This is as described in Section 3.
signature: This field contains the computed signature value. The signature: This field contains the computed signature value. The
type of the field is a bstr. Algorithms MUST specify padding if type of the field is a bstr. Algorithms MUST specify
the signature value is not a multiple of 8 bits. padding if the signature value is not a multiple of 8
bits.
The CDDL fragment that represents the above text for COSE_Signature The CDDL fragment that represents the above text for COSE_Signature
follows. follows.
COSE_Signature = [ COSE_Signature = [
Headers, Headers,
signature : bstr signature : bstr
] ]
4.2. Signing with One Signer 4.2. Signing with One Signer
skipping to change at page 19, line 36 skipping to change at page 21, line 41
The structure can be encoded as either tagged or untagged depending The structure can be encoded as either tagged or untagged depending
on the context it will be used in. A tagged COSE_Sign1 structure is on the context it will be used in. A tagged COSE_Sign1 structure is
identified by the CBOR tag 18. The CDDL fragment that represents identified by the CBOR tag 18. The CDDL fragment that represents
this is: this is:
COSE_Sign1_Tagged = #6.18(COSE_Sign1) COSE_Sign1_Tagged = #6.18(COSE_Sign1)
The CBOR object that carries the body, the signature, and the The CBOR object that carries the body, the signature, and the
information about the body and signature is called the COSE_Sign1 information about the body and signature is called the COSE_Sign1
structure. Examples of COSE_Sign1 messages can be found in structure. Examples of COSE_Sign1 messages can be found in
Appendix C.2. Section c.2.
The COSE_Sign1 structure is a CBOR array. The fields of the array in The COSE_Sign1 structure is a CBOR array. The fields of the array in
order are: order are:
protected: This is as described in Section 3. protected: This is as described in Section 3.
unprotected: This is as described in Section 3. unprotected: This is as described in Section 3.
payload: This is as described in Section 4.1. payload: This is as described in Section 4.1.
signature: This field contains the computed signature value. The signature: This field contains the computed signature value. The
type of the field is a bstr. type of the field is a bstr.
The CDDL fragment that represents the above text for COSE_Sign1 The CDDL fragment that represents the above text for COSE_Sign1
follows. follows.
COSE_Sign1 = [ COSE_Sign1 = [
Headers, Headers,
payload : bstr / nil, payload : bstr / nil,
signature : bstr signature : bstr
] ]
skipping to change at page 20, line 34 skipping to change at page 22, line 40
changes the set of accept values by including the field in the changes the set of accept values by including the field in the
application supplied data. application supplied data.
This document describes the process for using a byte array of This document describes the process for using a byte array of
externally supplied authenticated data; the method of constructing externally supplied authenticated data; the method of constructing
the byte array is a function of the application. Applications that the byte array is a function of the application. Applications that
use this feature need to define how the externally supplied use this feature need to define how the externally supplied
authenticated data is to be constructed. Such a construction needs authenticated data is to be constructed. Such a construction needs
to take into account the following issues: to take into account the following issues:
o If multiple items are included, applications need to ensure that * If multiple items are included, applications need to ensure that
the same byte string cannot produced if there are different the same byte string cannot produced if there are different
inputs. This would occur by appending the strings 'AB' and 'CDE' inputs. This would occur by appending the strings 'AB' and 'CDE'
or by appending the strings 'ABC' and 'DE'. This is usually or by appending the strings 'ABC' and 'DE'. This is usually
addressed by making fields a fixed width and/or encoding the addressed by making fields a fixed width and/or encoding the
length of the field as part of the output. Using options from length of the field as part of the output. Using options from
CoAP [RFC7252] as an example, these fields use a TLV structure so CoAP [RFC7252] as an example, these fields use a TLV structure so
they can be concatenated without any problems. they can be concatenated without any problems.
o If multiple items are included, an order for the items needs to be * If multiple items are included, an order for the items needs to be
defined. Using options from CoAP as an example, an application defined. Using options from CoAP as an example, an application
could state that the fields are to be ordered by the option could state that the fields are to be ordered by the option
number. number.
o Applications need to ensure that the byte string is going to be * Applications need to ensure that the byte string is going to be
the same on both sides. Using options from CoAP might give a the same on both sides. Using options from CoAP might give a
problem if the same relative numbering is kept. An intermediate problem if the same relative numbering is kept. An intermediate
node could insert or remove an option, changing how the relative node could insert or remove an option, changing how the relative
number is done. An application would need to specify that the number is done. An application would need to specify that the
relative number must be re-encoded to be relative only to the relative number must be re-encoded to be relative only to the
options that are in the external data. options that are in the external data.
4.4. Signing and Verification Process 4.4. Signing and Verification Process
In order to create a signature, a well-defined byte string is needed. In order to create a signature, a well-defined byte string is needed.
skipping to change at page 24, line 13 skipping to change at page 26, line 18
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 Section 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 Section 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.1) 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
skipping to change at page 24, line 41 skipping to change at page 27, line 5
abbreviated countersignature are inferred from the same context used abbreviated countersignature are inferred from the same context used
to describe the encryption, signature, or MAC processing. 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 |
| | | Type | | | | | | Type | | |
+-------------------+-------+---------+-------+---------------------+ +===================+=======+============+=======+==================+
| CounterSignature0 | 9 | bstr | | Abbreviated | | CounterSignature0 | 9 | bstr | | Abbreviated |
| | | | | Countersignature | | | | | | Countersignature |
+-------------------+-------+---------+-------+---------------------+ +-------------------+-------+------------+-------+------------------+
Table 4: Header Parameter for CounterSignature0 Table 4: Header Parameter for CounterSignature0
6. Encryption Objects 6. Encryption Objects
COSE supports two different encryption structures. COSE_Encrypt0 is COSE supports two different encryption structures. COSE_Encrypt0 is
used when a recipient structure is not needed because the key to be used when a recipient structure is not needed because the key to be
used is known implicitly. COSE_Encrypt is used the rest of the time. used is known implicitly. COSE_Encrypt is used the rest of the time.
This includes cases where there are multiple recipients or a This includes cases where there are multiple recipients or a
recipient algorithm other than direct (i.e. pre-shared secret) is recipient algorithm other than direct (i.e. pre-shared secret) is
skipping to change at page 25, line 36 skipping to change at page 27, line 46
encryption algorithm. encryption algorithm.
The same techniques and nearly the same structure is used for The same techniques and nearly the same structure is used for
encrypting both the plaintext and the keys. This is different from encrypting both the plaintext and the keys. This is different from
the approach used by both "Cryptographic Message Syntax (CMS)" the approach used by both "Cryptographic Message Syntax (CMS)"
[RFC5652] and "JSON Web Encryption (JWE)" [RFC7516] where different [RFC5652] and "JSON Web Encryption (JWE)" [RFC7516] where different
structures are used for the content layer and for the recipient structures are used for the content layer and for the recipient
layer. Two structures are defined: COSE_Encrypt to hold the layer. Two structures are defined: COSE_Encrypt to hold the
encrypted content and COSE_recipient to hold the encrypted keys for encrypted content and COSE_recipient to hold the encrypted keys for
recipients. Examples of encrypted messages can be found in recipients. Examples of encrypted messages can be found in
Appendix C.3. Section c.3.
The COSE_Encrypt structure can be encoded as either tagged or The COSE_Encrypt structure can be encoded as either tagged or
untagged depending on the context it will be used in. A tagged untagged depending on the context it will be used in. A tagged
COSE_Encrypt structure is identified by the CBOR tag 96. The CDDL COSE_Encrypt structure is identified by the CBOR tag 96. The CDDL
fragment that represents this is: fragment that represents this is:
COSE_Encrypt_Tagged = #6.96(COSE_Encrypt) COSE_Encrypt_Tagged = #6.96(COSE_Encrypt)
The COSE_Encrypt structure is a CBOR array. The fields of the array The COSE_Encrypt structure is a CBOR array. The fields of the array
in order are: in order are:
protected: This is as described in Section 3. protected: This is as described in Section 3.
unprotected: This is as described in Section 3. unprotected: This is as described in Section 3.
ciphertext: This field contains the ciphertext encoded as a bstr. ciphertext: This field contains the ciphertext encoded as a bstr.
If the ciphertext is to be transported independently of the If the ciphertext is to be transported independently of
control information about the encryption process (i.e., detached the control information about the encryption process
content), then the field is encoded as a nil value. (i.e., detached content), then the field is encoded as
a nil value.
recipients: This field contains an array of recipient information recipients: This field contains an array of recipient information
structures. The type for the recipient information structure is a structures. The type for the recipient information
COSE_recipient. structure is a COSE_recipient.
The CDDL fragment that corresponds to the above text is: The CDDL fragment that corresponds to the above text is:
COSE_Encrypt = [ COSE_Encrypt = [
Headers, Headers,
ciphertext : bstr / nil, ciphertext : bstr / nil,
recipients : [+COSE_recipient] recipients : [+COSE_recipient]
] ]
The COSE_recipient structure is a CBOR array. The fields of the The COSE_recipient structure is a CBOR array. The fields of the
array in order are: array in order are:
protected: This is as described in Section 3. protected: This is as described in Section 3.
unprotected: This is as described in Section 3. unprotected: This is as described in Section 3.
ciphertext: This field contains the encrypted key encoded as a bstr. ciphertext: This field contains the encrypted key encoded as a
All encoded keys are symmetric keys; the binary value of the key bstr. All encoded keys are symmetric keys; the binary
is the content. If there is not an encrypted key, then this field value of the key is the content. If there is not an
is encoded as a nil value. encrypted key, then this field is encoded as a nil
value.
recipients: This field contains an array of recipient information recipients: This field contains an array of recipient information
structures. The type for the recipient information structure is a structures. The type for the recipient information
COSE_recipient (an example of this can be found in Appendix B). structure is a COSE_recipient (an example of this can
If there are no recipient information structures, this element is be found in Appendix B). If there are no recipient
absent. information structures, this element is absent.
The CDDL fragment that corresponds to the above text for The CDDL fragment that corresponds to the above text for
COSE_recipient is: COSE_recipient is:
COSE_recipient = [ COSE_recipient = [
Headers, Headers,
ciphertext : bstr / nil, ciphertext : bstr / nil,
? recipients : [+COSE_recipient] ? recipients : [+COSE_recipient]
] ]
skipping to change at page 27, line 42 skipping to change at page 29, line 48
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.
Examples of encrypted messages can be found in Appendix C.3. Examples of encrypted messages can be found in Section c.3.
The COSE_Encrypt0 structure can be encoded as either tagged or The COSE_Encrypt0 structure can be encoded as either tagged or
untagged depending on the context it will be used in. A tagged untagged depending on the context it will be used in. A tagged
COSE_Encrypt0 structure is identified by the CBOR tag 16. The CDDL COSE_Encrypt0 structure is identified by the CBOR tag 16. The CDDL
fragment that represents this is: fragment that represents this is:
COSE_Encrypt0_Tagged = #6.16(COSE_Encrypt0) COSE_Encrypt0_Tagged = #6.16(COSE_Encrypt0)
The COSE_Encrypt0 structure is a CBOR array. The fields of the array The COSE_Encrypt0 structure is a CBOR array. The fields of the array
in order are: in order are:
protected: This is as described in Section 3. protected: This is as described in Section 3.
unprotected: This is as described in Section 3. unprotected: This is as described in Section 3.
ciphertext: This is as described in Section 6.1. ciphertext: This is as described in Section 6.1.
The CDDL fragment for COSE_Encrypt0 that corresponds to the above The CDDL fragment for COSE_Encrypt0 that corresponds to the above
text is: text is:
COSE_Encrypt0 = [ COSE_Encrypt0 = [
Headers, Headers,
ciphertext : bstr / nil, ciphertext : bstr / nil,
] ]
6.3. How to Encrypt and Decrypt for AEAD Algorithms 6.3. How to Encrypt and Decrypt for AEAD Algorithms
skipping to change at page 29, line 31 skipping to change at page 31, line 40
Section 10. 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 9.5.3), key wrap keys (Section 9.5.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
determined by the key and algorithm in the recipient Agreement: The key is determined by the
structure. The encryption algorithm and size of the key to be key and algorithm in the recipient structure. The encryption
used are inputs into the KDF used for the recipient. (For algorithm and size of the key to be used are inputs into the
direct, the KDF can be thought of as the identity operation.) KDF used for the recipient. (For direct, the KDF can be
Examples of these algorithms are found in Sections 6.1.2 and thought of as the identity operation.) Examples of these
6.3 of [I-D.ietf-cose-rfc8152bis-algs]. algorithms are found in Sections 6.1.2 and 6.3 of
[I-D.ietf-cose-rfc8152bis-algs].
Other: The key is randomly or pseudorandomly generated. Other: The key is randomly or pseudorandomly generated.
4. Call the encryption algorithm with K (the encryption key), P (the 4. Call the encryption algorithm with K (the encryption key), P (the
plaintext), and AAD. Place the returned ciphertext into the plaintext), and AAD. Place the returned ciphertext into the
'ciphertext' field of the structure. 'ciphertext' field of the structure.
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.
skipping to change at page 30, line 16 skipping to change at page 32, line 27
encoding described in Section 10. 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 9.5.3), key wrap keys (Section 9.5.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
determined by the key and algorithm in the recipient Agreement: The key is determined by the
structure. The encryption algorithm and size of the key to be key and algorithm in the recipient structure. The encryption
used are inputs into the KDF used for the recipient. (For algorithm and size of the key to be used are inputs into the
direct, the KDF can be thought of as the identity operation.) KDF used for the recipient. (For direct, the KDF can be
thought of as the identity operation.)
Other: The key is determined by decoding and decrypting one of Other: The key is determined by decoding and decrypting one of
the recipient structures. the recipient structures.
4. Call the decryption algorithm with K (the decryption key to use), 4. Call the decryption algorithm with K (the decryption key to use),
C (the ciphertext), and AAD. C (the ciphertext), and AAD.
6.4. How to Encrypt and Decrypt for AE Algorithms 6.4. How to Encrypt and Decrypt for AE Algorithms
How to encrypt a message: How to encrypt a message:
skipping to change at page 30, line 45 skipping to change at page 33, line 10
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 9.5.3), key wrap keys (Section 9.5.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
determined by the key and algorithm in the recipient Agreement: The key is determined by the
structure. The encryption algorithm and size of the key to be key and algorithm in the recipient structure. The encryption
used are inputs into the KDF used for the recipient. (For algorithm and size of the key to be used are inputs into the
direct, the KDF can be thought of as the identity operation.) KDF used for the recipient. (For direct, the KDF can be
Examples of these algorithms are found in Sections 6.1.2 and thought of as the identity operation.) Examples of these
6.3 of [I-D.ietf-cose-rfc8152bis-algs]. algorithms are found in Sections 6.1.2 and 6.3 of
[I-D.ietf-cose-rfc8152bis-algs].
Other: The key is randomly generated. Other: The key is randomly generated.
4. Call the encryption algorithm with K (the encryption key to use) 4. Call the encryption algorithm with K (the encryption key to use)
and P (the plaintext). Place the returned ciphertext into the and P (the plaintext). Place the returned ciphertext into the
'ciphertext' field of the structure. 'ciphertext' field of the structure.
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.
skipping to change at page 31, line 30 skipping to change at page 33, line 44
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 9.5.3), key wrap keys (Section 9.5.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
determined by the key and algorithm in the recipient Agreement: The key is determined by the
structure. The encryption algorithm and size of the key to be key and algorithm in the recipient structure. The encryption
used are inputs into the KDF used for the recipient. (For algorithm and size of the key to be used are inputs into the
direct, the KDF can be thought of as the identity operation.) KDF used for the recipient. (For direct, the KDF can be
Examples of these algorithms are found in Sections 6.1.2 and thought of as the identity operation.) Examples of these
6.3 of [I-D.ietf-cose-rfc8152bis-algs]. algorithms are found in Sections 6.1.2 and 6.3 of
[I-D.ietf-cose-rfc8152bis-algs].
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.
4. Call the decryption algorithm with K (the decryption key to use) 4. Call the decryption algorithm with K (the decryption key to use)
and C (the ciphertext). and C (the ciphertext).
7. MAC Objects 7. MAC Objects
COSE supports two different MAC structures. COSE_MAC0 is used when a COSE supports two different MAC structures. COSE_MAC0 is used when a
skipping to change at page 32, line 30 skipping to change at page 34, line 44
assumes that there are only two parties involved and that you did not assumes that there are only two parties involved and that you did not
send the message to yourself.) The origination property can be send the message to yourself.) The origination property can be
obtained with both of the MAC message structures. obtained with both of the MAC message structures.
7.1. MACed Message with Recipients 7.1. MACed Message with Recipients
The multiple recipient MACed message uses two structures: the The multiple recipient MACed message uses two structures: the
COSE_Mac structure defined in this section for carrying the body and COSE_Mac structure defined in this section for carrying the body and
the COSE_recipient structure (Section 6.1) to hold the key used for the COSE_recipient structure (Section 6.1) to hold the key used for
the MAC computation. Examples of MACed messages can be found in the MAC computation. Examples of MACed messages can be found in
Appendix C.5. Section c.5.
The MAC structure can be encoded as either tagged or untagged The MAC structure can be encoded as either tagged or untagged
depending on the context it will be used in. A tagged COSE_Mac depending on the context it will be used in. A tagged COSE_Mac
structure is identified by the CBOR tag 97. The CDDL fragment that structure is identified by the CBOR tag 97. The CDDL fragment that
represents this is: represents this is:
COSE_Mac_Tagged = #6.97(COSE_Mac) COSE_Mac_Tagged = #6.97(COSE_Mac)
The COSE_Mac structure is a CBOR array. The fields of the array in The COSE_Mac structure is a CBOR array. The fields of the array in
order are: order are:
protected: This is as described in Section 3. protected: This is as described in Section 3.
unprotected: This is as described in Section 3. unprotected: This is as described in Section 3.
payload: This field contains the serialized content to be MACed. If payload: This field contains the serialized content to be MACed.
the payload is not present in the message, the application is If the payload is not present in the message, the
required to supply the payload separately. The payload is wrapped application is required to supply the payload
in a bstr to ensure that it is transported without changes. If separately. The payload is wrapped in a bstr to ensure
the payload is transported separately (i.e., detached content), that it is transported without changes. If the payload
then a nil CBOR value is placed in this location, and it is the is transported separately (i.e., detached content),
responsibility of the application to ensure that it will be then a nil CBOR value is placed in this location, and
transported without changes. it is the responsibility of the application to ensure
that it will be transported without changes.
tag: This field contains the MAC value. tag: This field contains the MAC value.
recipients: This is as described in Section 6.1. recipients: This is as described in Section 6.1.
The CDDL fragment that represents the above text for COSE_Mac The CDDL fragment that represents the above text for COSE_Mac
follows. follows.
COSE_Mac = [ COSE_Mac = [
Headers, Headers,
payload : bstr / nil, payload : bstr / nil,
tag : bstr, tag : bstr,
recipients :[+COSE_recipient] recipients :[+COSE_recipient]
] ]
7.2. MACed Messages with Implicit Key 7.2. MACed Messages with Implicit Key
In this section, we describe the structure and methods to be used In this section, we describe the structure and methods to be used
when doing MAC authentication for those cases where the recipient is when doing MAC authentication for those cases where the recipient is
implicitly known. implicitly known.
The MACed message uses the COSE_Mac0 structure defined in this The MACed message uses the COSE_Mac0 structure defined in this
section for carrying the body. Examples of MACed messages with an section for carrying the body. Examples of MACed messages with an
implicit key can be found in Appendix C.6. implicit key can be found in Section c.6.
The MAC structure can be encoded as either tagged or untagged The MAC structure can be encoded as either tagged or untagged
depending on the context it will be used in. A tagged COSE_Mac0 depending on the context it will be used in. A tagged COSE_Mac0
structure is identified by the CBOR tag 17. The CDDL fragment that structure is identified by the CBOR tag 17. The CDDL fragment that
represents this is: represents this is:
COSE_Mac0_Tagged = #6.17(COSE_Mac0) COSE_Mac0_Tagged = #6.17(COSE_Mac0)
The COSE_Mac0 structure is a CBOR array. The fields of the array in The COSE_Mac0 structure is a CBOR array. The fields of the array in
order are: order are:
protected: This is as described in Section 3. protected: This is as described in Section 3.
unprotected: This is as described in Section 3. unprotected: This is as described in Section 3.
payload: This is as described in Section 7.1. payload: This is as described in Section 7.1.
tag: This field contains the MAC value. tag: This field contains the MAC value.
The CDDL fragment that corresponds to the above text is: The CDDL fragment that corresponds to the above text is:
COSE_Mac0 = [ COSE_Mac0 = [
Headers, Headers,
payload : bstr / nil, payload : bstr / nil,
tag : bstr, tag : bstr,
] ]
7.3. How to Compute and Verify a MAC 7.3. How to Compute and Verify a MAC
skipping to change at page 35, line 40 skipping to change at page 38, line 16
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 12.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 Section 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
is not understood by an application, that key is ignored and the is not understood by an application, that key is ignored and the
other keys are processed normally. other keys are processed normally.
The element "kty" is a required element in a COSE_Key map. The element "kty" is a required element in a COSE_Key map.
The CDDL grammar describing COSE_Key and COSE_KeySet is: The CDDL grammar describing COSE_Key and COSE_KeySet is:
skipping to change at page 36, line 24 skipping to change at page 39, line 5
COSE_KeySet = [+COSE_Key] COSE_KeySet = [+COSE_Key]
8.1. COSE Key Common Parameters 8.1. COSE Key Common Parameters
This document defines a set of common parameters for a COSE Key This document defines a set of common parameters for a COSE Key
object. Table 5 provides a summary of the parameters defined in this object. Table 5 provides a summary of the parameters defined in this
section. There are also parameters that are defined for specific key section. There are also parameters that are defined for specific key
types. Key-type-specific parameters can be found in types. Key-type-specific parameters can be found in
[I-D.ietf-cose-rfc8152bis-algs]. [I-D.ietf-cose-rfc8152bis-algs].
+---------+-------+----------------+------------+-------------------+ +---------+-------+-------------+------------+--------------------+
| Name | Label | CBOR Type | Value | Description | | Name | Label | CBOR Type | Value | Description |
| | | | Registry | | | | | | Registry | |
+---------+-------+----------------+------------+-------------------+ +=========+=======+=============+============+====================+
| kty | 1 | tstr / int | COSE Key | Identification of | | kty | 1 | tstr / int | COSE Key | Identification of |
| | | | Types | the key type | | | | | Types | the key type |
| | | | | | +---------+-------+-------------+------------+--------------------+
| kid | 2 | bstr | | Key | | kid | 2 | bstr | | Key identification |
| | | | | identification | | | | | | value -- match to |
| | | | | value -- match to | | | | | | kid in message |
| | | | | kid in message | +---------+-------+-------------+------------+--------------------+
| | | | | | | alg | 3 | tstr / int | COSE | Key usage |
| alg | 3 | tstr / int | COSE | Key usage | | | | | Algorithms | restriction to |
| | | | Algorithms | restriction to | | | | | | this algorithm |
| | | | | this algorithm | +---------+-------+-------------+------------+--------------------+
| | | | | | | key_ops | 4 | [+ (tstr/ | | Restrict set of |
| key_ops | 4 | [+ (tstr/int)] | | Restrict set of | | | | int)] | | permissible |
| | | | | permissible | | | | | | operations |
| | | | | operations | +---------+-------+-------------+------------+--------------------+
| | | | | | | Base IV | 5 | bstr | | Base IV to be xor- |
| Base IV | 5 | bstr | | Base IV to be | | | | | | ed with Partial |
| | | | | xor-ed with | | | | | | IVs |
| | | | | Partial IVs | +---------+-------+-------------+------------+--------------------+
+---------+-------+----------------+------------+-------------------+
Table 5: Key Map Labels Table 5: Key Map Labels
kty: This parameter is used to identify the family of keys for this kty: This parameter is used to identify the family of keys for
structure and, thus, the set of key-type-specific parameters to be this structure and, thus, the set of key-type-specific
found. The set of values defined in this document can be found in parameters to be found. The set of values defined in this
[COSE.KeyTypes]. This parameter MUST be present in a key object. document can be found in [COSE.KeyTypes]. This parameter
Implementations MUST verify that the key type is appropriate for MUST be present in a key object. Implementations MUST
the algorithm being processed. The key type MUST be included as verify that the key type is appropriate for the algorithm
part of the trust decision process. being processed. The key type MUST be included as part of
the trust decision process.
alg: This parameter is used to restrict the algorithm that is used alg: This parameter is used to restrict the algorithm that is
with the key. If this parameter is present in the key structure, used with the key. If this parameter is present in the key
the application MUST verify that this algorithm matches the structure, the application MUST verify that this algorithm
algorithm for which the key is being used. If the algorithms do matches the algorithm for which the key is being used. If
not match, then this key object MUST NOT be used to perform the the algorithms do not match, then this key object MUST NOT
cryptographic operation. Note that the same key can be in a be used to perform the cryptographic operation. Note that
different key structure with a different or no algorithm the same key can be in a different key structure with a
specified; however, this is considered to be a poor security different or no algorithm specified; however, this is
practice. considered to be a poor security practice.
kid: This parameter is used to give an identifier for a key. The kid: This parameter is used to give an identifier for a key.
identifier is not structured and can be anything from a user- The identifier is not structured and can be anything from a
provided string to a value computed on the public portion of the user-provided string to a value computed on the public
key. This field is intended for matching against a 'kid' portion of the key. This field is intended for matching
parameter in a message in order to filter down the set of keys against a 'kid' parameter in a message in order to filter
that need to be checked. down the set of keys that need to be checked.
key_ops: This parameter is defined to restrict the set of operations key_ops: This parameter is defined to restrict the set of operations
that a key is to be used for. The value of the field is an array that a key is to be used for. The value of the field is an
of values from Table 6. Algorithms define the values of key ops array of values from Table 6. Algorithms define the values
that are permitted to appear and are required for specific of key ops that are permitted to appear and are required
operations. The set of values matches that in [RFC7517] and for specific operations. The set of values matches that in
[W3C.WebCrypto]. [RFC7517] and [W3C.WebCrypto].
Base IV: This parameter is defined to carry the base portion of an Base IV: This parameter is defined to carry the base portion of an
IV. It is designed to be used with the Partial IV header IV. It is designed to be used with the Partial IV header
parameter defined in Section 3.1. This field provides the ability parameter defined in Section 3.1. This field provides the
to associate a Partial IV with a key that is then modified on a ability to associate a Partial IV with a key that is then
per message basis with the Partial IV. modified on a per message basis with the Partial IV.
Extreme care needs to be taken when using a Base IV in an Extreme care needs to be taken when using a Base IV in an
application. Many encryption algorithms lose security if the same application. Many encryption algorithms lose security if
IV is used twice. the same IV is used twice.
If different keys are derived for each sender, using the same Base If different keys are derived for each sender, using the
IV with Partial IVs starting at zero is likely to ensure that the same Base IV with Partial IVs starting at zero is likely to
IV would not be used twice for a single key. If different keys ensure that the IV would not be used twice for a single
are derived for each sender, starting at the same Base IV is key. If different keys are derived for each sender,
likely to satisfy this condition. If the same key is used for starting at the same Base IV is likely to satisfy this
multiple senders, then the application needs to provide for a condition. If the same key is used for multiple senders,
method of dividing the IV space up between the senders. This then the application needs to provide for a method of
could be done by providing a different base point to start from or dividing the IV space up between the senders. This could
a different Partial IV to start with and restricting the number of be done by providing a different base point to start from
messages to be sent before rekeying. or a different Partial IV to start with and restricting the
number of messages to be sent before rekeying.
+---------+-------+-------------------------------------------------+ +---------+-------+----------------------------------------------+
| Name | Value | Description | | Name | Value | Description |
+---------+-------+-------------------------------------------------+ +=========+=======+==============================================+
| sign | 1 | The key is used to create signatures. Requires | | sign | 1 | The key is used to create signatures. |
| | | private key fields. | | | | Requires private key fields. |
| verify | 2 | The key is used for verification of signatures. | +---------+-------+----------------------------------------------+
| encrypt | 3 | The key is used for key transport encryption. | | verify | 2 | The key is used for verification of |
| decrypt | 4 | The key is used for key transport decryption. | | | | signatures. |
| | | Requires private key fields. | +---------+-------+----------------------------------------------+
| wrap | 5 | The key is used for key wrap encryption. | | encrypt | 3 | The key is used for key transport |
| key | | | | | | encryption. |
| unwrap | 6 | The key is used for key wrap decryption. | +---------+-------+----------------------------------------------+
| key | | Requires private key fields. | | decrypt | 4 | The key is used for key transport |
| derive | 7 | The key is used for deriving keys. Requires | | | | decryption. Requires private key fields. |
| key | | private key fields. | +---------+-------+----------------------------------------------+
| derive | 8 | The key is used for deriving bits not to be | | wrap | 5 | The key is used for key wrap encryption. |
| bits | | used as a key. Requires private key fields. | | key | | |
| MAC | 9 | The key is used for creating MACs. | +---------+-------+----------------------------------------------+
| create | | | | unwrap | 6 | The key is used for key wrap decryption. |
| MAC | 10 | The key is used for validating MACs. | | key | | Requires private key fields. |
| verify | | | +---------+-------+----------------------------------------------+
+---------+-------+-------------------------------------------------+ | derive | 7 | The key is used for deriving keys. Requires |
| key | | private key fields. |
+---------+-------+----------------------------------------------+
| derive | 8 | The key is used for deriving bits not to be |
| bits | | used as a key. Requires private key fields. |
+---------+-------+----------------------------------------------+
| MAC | 9 | The key is used for creating MACs. |
| create | | |
+---------+-------+----------------------------------------------+
| MAC | 10 | The key is used for validating MACs. |
| verify | | |
+---------+-------+----------------------------------------------+
Table 6: Key Operation Values Table 6: Key Operation Values
9. Taxonomy of Algorithms used by COSE 9. Taxonomy of Algorithms used by COSE
In this section, a taxonomy of the different algorithm types that can 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 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 to be exhaustive as there are new algorithm structures that could be
found or are not known to the author. found or are not known to the author.
9.1. Signature Algorithms 9.1. Signature Algorithms
skipping to change at page 41, line 10 skipping to change at page 44, line 16
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.
9.4. 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 * 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 * 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.
o Secrets that are not random: This is the type of secret that * Secrets that are not random: This is the type of secret that
people generate for things like passwords. people generate for things like passwords.
General KDFs work well with the first type of secret, can do General KDFs work well with the first type of secret, can do
reasonably well with the second type of secret, and generally do reasonably well with the second type of secret, and generally do
poorly with the last type of secret. Functions like PBES2 [RFC8018] poorly with the last type of secret. Functions like PBES2 [RFC8018]
need to be used for non-random secrets. need to be used for non-random secrets.
The same KDF can be set up to deal with the first two types of The same KDF can be set up to deal with the first two types of
secrets in a different way. The KDF defined in section 5.1 of secrets in a different way. The KDF defined in section 5.1 of
[I-D.ietf-cose-rfc8152bis-algs] is such a function. This is [I-D.ietf-cose-rfc8152bis-algs] is such a function. This is
skipping to change at page 42, line 8 skipping to change at page 45, line 15
9.5.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 * 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. * The 'alg' parameter MUST be present.
o A parameter identifying the shared secret SHOULD be present. * A parameter identifying the shared secret SHOULD be present.
o The 'ciphertext' field MUST be a zero-length item. * The 'ciphertext' field MUST be a zero-length item.
o The 'recipients' field MUST be absent. * The 'recipients' field MUST be absent.
9.5.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
algorithms. algorithms.
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 MUST be absent if the key wrap algorithm is * The 'protected' field MUST be absent if the key wrap algorithm is
an AE algorithm. an AE algorithm.
o The 'recipients' field is normally absent, but can be used. * The 'recipients' field is normally absent, but can be used.
Applications MUST deal with a recipient field being present that Applications MUST deal with a recipient field being present that
has an unsupported algorthms, not being able to decrypt that has an unsupported algorthms, not being able to decrypt that
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 * 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' * 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.
9.5.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. * The 'protected' field MUST be absent.
o The plaintext to be encrypted is the key from the next layer down * 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' * 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.
9.5.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).
skipping to change at page 44, line 15 skipping to change at page 47, line 20
different key is created for each message. different key is created for each message.
When direct key agreement mode is used, there MUST be only one When direct key agreement mode is used, there MUST be only one
recipient in the message. This method creates the key directly, and recipient in the message. This method creates the key directly, and
that makes it difficult to mix with additional recipients. If that makes it difficult to mix with additional recipients. If
multiple recipients are needed, then the version with key wrap needs multiple recipients are needed, then the version with key wrap needs
to be used. to be used.
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 * 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 * 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.
9.5.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. * The 'protected' field is fed into the KDF context structure.
o The plaintext to be encrypted is the key from the next layer down * 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. * The 'alg' parameter MUST be present in the layer.
o A parameter identifying the recipient's key SHOULD be present. A * 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.
10. 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 * 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 values MUST be * Encoding MUST be done using definite lengths and values MUST be
the minimum possible length. This means that the integer 1 is the minimum possible length. This means that the integer 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 * 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.
11. 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
skipping to change at page 45, line 34 skipping to change at page 48, line 44
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 [RFC8613] where one was An example of a profile can be found in [RFC8613] where one was
developed for carrying content in combination with CoAP headers. developed for 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 * 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.
o Applications may define new header parameters for a specific * Applications may define new header parameters for a specific
purpose. Applications will often times select specific header purpose. Applications will often times select specific header
parameters to use or not to use. For example, an application parameters to use or not to use. For example, an application
would normally state a preference for using either the IV or the would normally state a preference for using either the IV or the
Partial IV parameter. If the Partial IV parameter is specified, Partial IV parameter. If the Partial IV parameter is specified,
then the application also needs to define how the fixed portion of then the application also needs to define how the fixed portion of
the IV is determined. the IV is determined.
o When applications use externally defined authenticated data, they * When applications use externally defined authenticated data, they
need to define how that data is encoded. This document assumes need to define how that data is encoded. This document assumes
that the data will be provided as a byte string. More information that the data will be provided as a byte string. More information
can be found in Section 4.3. can be found in Section 4.3.
o Applications need to determine the set of security algorithms that * Applications need to determine the set of security algorithms that
are to be used. When selecting the algorithms to be used as the are to be used. When selecting the algorithms to be used as the
mandatory-to-implement set, consideration should be given to mandatory-to-implement set, consideration should be given to
choosing different types of algorithms when two are chosen for a choosing different types of algorithms when two are chosen for a
specific purpose. An example of this would be choosing HMAC- specific purpose. An example of this would be choosing HMAC-
SHA512 and AES-CMAC as different MAC algorithms; the construction SHA512 and AES-CMAC as different MAC algorithms; the construction
is vastly different between these two algorithms. This means that is vastly different between these two algorithms. This means that
a weakening of one algorithm would be unlikely to lead to a a weakening of one algorithm would be unlikely to lead to a
weakening of the other algorithms. Of course, these algorithms do weakening of the other algorithms. Of course, these algorithms do
not provide the same level of security and thus may not be not provide the same level of security and thus may not be
comparable for the desired security functionality. comparable for the desired security functionality.
o Applications may need to provide some type of negotiation or * Applications may need to provide some type of negotiation or
discovery method if multiple algorithms or message structures are discovery method if multiple algorithms or message structures are
permitted. The method can be as simple as requiring permitted. The method can be as simple as requiring
preconfiguration of the set of algorithms to providing a discovery preconfiguration of the set of algorithms to providing a discovery
method built into the protocol. S/MIME provided a number of method built into the protocol. S/MIME provided a number of
different ways to approach the problem that applications could different ways to approach the problem that applications could
follow: follow:
* 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]).
12. 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.
12.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
Data Item: COSE_Signature * Data Item: COSE_Signature
Semantics: COSE standalone counter signature
Reference: [[this document]] * Semantics: COSE standalone counter signature
* Reference: [[this document]]
12.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].
skipping to change at page 48, line 22 skipping to change at page 51, line 37
Published specification: [[this document]] Published specification: [[this document]]
Applications that use this media type: IoT applications sending Applications that use this media type: IoT applications sending
security content over HTTP(S) transports. security content over HTTP(S) transports.
Fragment identifier considerations: N/A Fragment identifier considerations: N/A
Additional information: Additional information:
* Deprecated alias names for this type: N/A - Deprecated alias names for this type: N/A
* Magic number(s): N/A - Magic number(s): N/A
* File extension(s): cbor - File extension(s): cbor
* Macintosh file type code(s): N/A - Macintosh file type code(s): N/A
Person & email address to contact for further information: Person & email address to contact for further information:
iesg@ietf.org iesg@ietf.org
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
12.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.
skipping to change at page 49, line 29 skipping to change at page 52, line 41
Published specification: [[this document]] Published specification: [[this document]]
Applications that use this media type: Distribution of COSE based Applications that use this media type: Distribution of COSE based
keys for IoT applications. keys for IoT applications.
Fragment identifier considerations: N/A Fragment identifier considerations: N/A
Additional information: Additional information:
* Deprecated alias names for this type: N/A - Deprecated alias names for this type: N/A
* Magic number(s): N/A - Magic number(s): N/A
* File extension(s): cbor - File extension(s): cbor
* Macintosh file type code(s): N/A - Macintosh file type code(s): N/A
Person & email address to contact for further information: Person & email address to contact for further information:
iesg@ietf.org iesg@ietf.org
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
skipping to change at page 50, line 26 skipping to change at page 53, line 40
Published specification: [[this document]] Published specification: [[this document]]
Applications that use this media type: Distribution of COSE based Applications that use this media type: Distribution of COSE based
keys for IoT applications. keys for IoT applications.
Fragment identifier considerations: N/A Fragment identifier considerations: N/A
Additional information: Additional information:
* Deprecated alias names for this type: N/A - Deprecated alias names for this type: N/A
* Magic number(s): N/A - Magic number(s): N/A
* File extension(s): cbor - File extension(s): cbor
* Macintosh file type code(s): N/A - Macintosh file type code(s): N/A
Person & email address to contact for further information: Person & email address to contact for further information:
iesg@ietf.org iesg@ietf.org
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
12.6. CoAP Content-Formats Registry 12.6. CoAP Content-Formats Registry
skipping to change at page 51, line 18 skipping to change at page 54, line 31
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 that need to be highlighted on individuals. There are some cases that need to be highlighted on
this issue. this issue.
o Using the same key for two different algorithms can leak * 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 * 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 [I-D.ietf-cose-rfc8152bis-algs] have * Several of the algorithms in [I-D.ietf-cose-rfc8152bis-algs] have
limits on the number of times that a key can be used without limits on the number of times that a key can be used without
leaking information 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
skipping to change at page 52, line 14 skipping to change at page 55, line 28
correct, the key form needs to be checked as well. Do not use an correct, the key form needs to be checked as well. Do not use an
'EC2' key where an 'OKP' key is expected. 'EC2' key where an 'OKP' key is expected.
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? * What are the permissions associated with the key owner?
o Is the cryptographic algorithm acceptable in the current context? * Is the cryptographic algorithm acceptable in the current context?
o Have the restrictions associated with the key, such as algorithm * 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 * 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 * 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 There are a large number of algorithms presented in
[I-D.ietf-cose-rfc8152bis-algs] that use nonce values. Nonces [I-D.ietf-cose-rfc8152bis-algs] that use nonce values. Nonces
generally have some type of restriction on their values. Generally a generally have some type of restriction on their values. Generally a
nonce needs to be a unique value either for a key or for some other nonce needs to be a unique value either for a key or for some other
conditions. In all of these cases, there is no known requirement on conditions. In all of these cases, there is no known requirement on
the nonce being both unique and unpredictable; under these the nonce being both unique and unpredictable; under these
circumstances, it's reasonable to use a counter for creation of the circumstances, it's reasonable to use a counter for creation of the
nonce. In cases where one wants the pattern of the nonce to be nonce. In cases where one wants the pattern of the nonce to be
skipping to change at page 53, line 7 skipping to change at page 56, line 19
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 [I-D.ietf-cose-rfc8152bis-algs] algorithms that are defined in [I-D.ietf-cose-rfc8152bis-algs]
document. This means that it is up to the applications to document document. This means that it is up to the applications to document
how content padding is to be done in order to prevent or discourage how content padding is to be done in order to prevent or discourage
such analysis. (For example, the strings could be defined as 'YES' such analysis. (For example, the strings could be defined as 'YES'
and 'NO '.) and 'NO '.)
14. Implementation Status 14. Implementation Status
This section is to be removed before publishing as an RFC.
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
be construed to be, a catalog of available implementations or their be construed to be, a catalog of available implementations or their
skipping to change at page 53, line 34 skipping to change at page 56, line 48
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".
14.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
Languages: There are three different languages that are currently * Primary Maintainer: Jim Schaad
* 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
14.2. JavaScript 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
14.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
14.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
15. References 15. References
15.1. Normative References 15.1. Normative References
[COAP.Formats] [COAP.Formats]
IANA, "CoAP Content-Formats", IANA, "CoAP Content-Formats", August 2019,
<https://www.iana.org/assignments/core-parameters/ <https://www.iana.org/assignments/core-parameters/core-
core-parameters.xhtml#content-formats>. parameters.xhtml#content-formats>.
[COSE.Algorithms] [COSE.Algorithms]
IANA, "COSE Algorithms", IANA, "COSE Algorithms", August 2019,
<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", August 2019,
<https://www.iana.org/assignments/cose/ <https://www.iana.org/assignments/cose/cose.xhtml#key-
cose.xhtml#key-common-parameters>. common-parameters>.
[COSE.KeyTypes] [COSE.KeyTypes]
IANA, "COSE Key Types", IANA, "COSE Key Types", August 2019,
<https://www.iana.org/assignments/cose/ <https://www.iana.org/assignments/cose/cose.xhtml#key-
cose.xhtml#key-type>. 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)", DOI 10.6028/NIST.FIPS.186-4,
DOI 10.6028/NIST.FIPS.186-4, July 2013, FIPS PUB 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-03 Initial Algorithms", draft-ietf-cose-rfc8152bis-algs-03
(work in progress), June 2019. (work in progress), June 10, 2019,
<https://www.ietf.org/archive/id/draft-ietf-cose-
rfc8152bis-algs-03>.
[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>.
skipping to change at page 56, line 32 skipping to change at page 59, line 45
<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>.
15.2. Informative References 15.2. Informative References
[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,
<https://doi.org/10.1007/3-540-45353-9_11>.
[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/
Multipurpose Internet Mail Extensions (S/MIME) Multipurpose Internet Mail Extensions (S/MIME)
Capabilities", RFC 4262, DOI 10.17487/RFC4262, December Capabilities", RFC 4262, DOI 10.17487/RFC4262, December
2005, <https://www.rfc-editor.org/info/rfc4262>. 2005, <https://www.rfc-editor.org/info/rfc4262>.
skipping to change at page 59, line 43 skipping to change at page 63, line 7
them. them.
This set of recommendations applies to the case where an application This set of recommendations applies to the case where an application
is distributing a fixed algorithm along with the key information for is distributing a fixed algorithm along with the key information for
use in a single COSE object. This normally applies to the smallest use in a single COSE object. This normally applies to the smallest
of the COSE objects, specifically COSE_Sign1, COSE_Mac0, and of the COSE objects, specifically COSE_Sign1, COSE_Mac0, and
COSE_Encrypt0, but could apply to the other structures as well. COSE_Encrypt0, but could apply to the other structures as well.
The following items should be taken into account: The following items should be taken into account:
o Applications need to list the set of COSE structures that implicit * Applications need to list the set of COSE structures that implicit
algorithms are to be used in. Applications need to require that algorithms are to be used in. Applications need to require that
the receipt of an explicit algorithm identifier in one of these the receipt of an explicit algorithm identifier in one of these
structures will lead to the message being rejected. This structures will lead to the message being rejected. This
requirement is stated so that there will never be a case where requirement is stated so that there will never be a case where
there is any ambiguity about the question of which algorithm there is any ambiguity about the question of which algorithm
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 * 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 single algorithm. As noted for some of the algorithms in
[I-D.ietf-cose-rfc8152bis-algs], the use of the same key in [I-D.ietf-cose-rfc8152bis-algs], the use of the same key in
different related algorithms can lead to leakage of information different related algorithms can lead to leakage of information
about the key, leakage about the data or the ability to perform about the key, leakage about the data or the ability to perform
forgeries. forgeries.
o In many cases, applications that make the algorithm identifier * 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
example of how this can be done is to tie the context to a example of how this can be done is to tie the context to a
transaction identifier. Both would be sent on the original transaction identifier. Both would be sent on the original
message, but only the transaction identifier would need to be sent message, but only the transaction identifier would need to be sent
after that point as the context is tied into the transaction after that point as the context is tied into the transaction
identifier. Another way would be to associate a context with a identifier. Another way would be to associate a context with a
network address. All messages coming from a single network network address. All messages coming from a single network
address can be assumed to be associated with a specific context. address can be assumed to be associated with a specific context.
(In this case, the address would normally be distributed as part (In this case, the address would normally be distributed as part
of the context.) of the context.)
o Applications cannot rely on key identifiers being unique unless * Applications cannot rely on key identifiers being unique unless
they take significant efforts to ensure that they are computed in they take significant efforts to ensure that they are computed in
such a way as to create this guarantee. Even when an application such a way as to create this guarantee. Even when an application
does this, the uniqueness might be violated if the application is does this, the uniqueness might be violated if the application is
run in different contexts (i.e., with a different context run in different contexts (i.e., with a different context
provider) or if the system combines the security contexts from provider) or if the system combines the security contexts from
different applications together into a single store. different applications together into a single store.
o Applications should continue the practice of protecting the * Applications should continue the practice of protecting the
algorithm identifier. Since this is not done by placing it in the algorithm identifier. Since this is not done by placing it in the
protected attributes field, applications should define an protected attributes field, applications should define an
application-specific external data structure that includes this application-specific external data structure that includes this
value. This external data field can be used as such for content value. This external data field can be used as such for content
encryption, MAC, and signature algorithms. It can be used in the encryption, MAC, and signature algorithms. It can be used in the
SuppPrivInfo field for those algorithms that use a KDF to derive a SuppPrivInfo field for those algorithms that use a KDF to derive a
key value. Applications may also want to protect other key value. Applications may also want to protect other
information that is part of the context structure as well. It information that is part of the context structure as well. It
should be noted that those fields, such as the key or a Base IV, should be noted that those fields, such as the key or a Base IV,
are protected by virtue of being used in the cryptographic are protected by virtue of being used in the cryptographic
skipping to change at page 61, line 19 skipping to change at page 64, line 32
specified for a multiple layer COSE object. An example of how this specified for a multiple layer COSE object. An example of how this
would work is the encryption context that an application specifies, would work is the encryption context that an application specifies,
which contains a content encryption algorithm, a key wrap algorithm, which contains a content encryption algorithm, a key wrap algorithm,
a key identifier, and a shared secret. The sender omits sending the a key identifier, and a shared secret. The sender omits sending the
algorithm identifier for both the content layer and the recipient algorithm identifier for both the content layer and the recipient
layer leaving only the key identifier. The receiver then uses the layer leaving only the key identifier. The receiver then uses the
key identifier to get the implicit algorithm identifiers. key identifier to get the implicit algorithm identifiers.
The following additional items need to be taken into consideration: The following additional items need to be taken into consideration:
o Applications that want to support this will need to define a * Applications that want to support this will need to define a
structure that allows for, and clearly identifies, both the COSE structure that allows for, and clearly identifies, both the COSE
structure to be used with a given key and the structure and structure to be used with a given key and the structure and
algorithm to be used for the secondary layer. The key for the algorithm to be used for the secondary layer. The key for the
secondary layer is computed as normal from the recipient layer. secondary layer is computed as normal from the recipient layer.
The third case is having multiple implicit algorithm identifiers, but The third case is having multiple implicit algorithm identifiers, but
targeted at potentially unrelated layers or different COSE objects. targeted at potentially unrelated layers or different COSE objects.
There are a number of different scenarios where this might be There are a number of different scenarios where this might be
applicable. Some of these scenarios are: applicable. Some of these scenarios are:
o Two contexts are distributed as a pair. Each of the contexts is * Two contexts are distributed as a pair. Each of the contexts is
for use with a COSE_Encrypt message. Each context will consist of for use with a COSE_Encrypt message. Each context will consist of
distinct secret keys and IVs and potentially even different distinct secret keys and IVs and potentially even different
algorithms. One context is for sending messages from party A to algorithms. One context is for sending messages from party A to
party B, and the second context is for sending messages from party party B, and the second context is for sending messages from party
B to party A. This means that there is no chance for a reflection B to party A. This means that there is no chance for a reflection
attack to occur as each party uses different secret keys to send attack to occur as each party uses different secret keys to send
its messages; a message that is reflected back to it would fail to its messages; a message that is reflected back to it would fail to
decrypt. decrypt.
o Two contexts are distributed as a pair. The first context is used * Two contexts are distributed as a pair. The first context is used
for encryption of the message, and the second context is used to for encryption of the message, and the second context is used to
place a counter signature on the message. The intention is that place a counter signature on the message. The intention is that
the second context can be distributed to other entities the second context can be distributed to other entities
independently of the first context. This allows these entities to independently of the first context. This allows these entities to
validate that the message came from an individual without being validate that the message came from an individual without being
able to decrypt the message and see the content. able to decrypt the message and see the content.
o Two contexts are distributed as a pair. The first context * Two contexts are distributed as a pair. The first context
contains a key for dealing with MACed messages, and the second contains a key for dealing with MACed messages, and the second
context contains a key for dealing with encrypted messages. This context contains a key for dealing with encrypted messages. This
allows for a unified distribution of keys to participants for allows for a unified distribution of keys to participants for
different types of messages that have different keys, but where different types of messages that have different keys, but where
the keys may be used in a coordinated manner. the keys may be used in a coordinated manner.
For these cases, the following additional items need to be For these cases, the following additional items need to be
considered: considered:
o Applications need to ensure that the multiple contexts stay * Applications need to ensure that the multiple contexts stay
associated. If one of the contexts is invalidated for any reason, associated. If one of the contexts is invalidated for any reason,
all of the contexts associated with it should also be invalidated. all of the contexts associated with it should also be invalidated.
Appendix B. Two Layers of Recipient Information Appendix B. Two Layers of Recipient Information
All of the currently defined recipient algorithm classes only use two All of the currently defined recipient algorithm classes only use two
layers of the COSE_Encrypt structure. The first layer is the message layers of the COSE_Encrypt structure. The first layer is the message
content, and the second layer is the content key encryption. content, and the second layer is the content key encryption.
However, if one uses a recipient algorithm such as the RSA Key However, if one uses a recipient algorithm such as the RSA Key
Encapsulation Mechanism (RSA-KEM) (see Appendix A of RSA-KEM Encapsulation Mechanism (RSA-KEM) (see Appendix A of RSA-KEM
[RFC5990]), then it makes sense to have three layers of the [RFC5990]), then it makes sense to have three layers of the
COSE_Encrypt structure. COSE_Encrypt structure.
These layers would be: These layers would be:
o Layer 0: The content encryption layer. This layer contains the * Layer 0: The content encryption layer. This layer contains the
payload of the message. payload of the message.
o Layer 1: The encryption of the CEK by a KEK. * Layer 1: The encryption of the CEK by a KEK.
o Layer 2: The encryption of a long random secret using an RSA key * Layer 2: The encryption of a long random secret using an RSA key
and a key derivation function to convert that secret into the KEK. and a key derivation function to convert that secret into the KEK.
This is an example of what a triple layer message would look like. This is an example of what a triple layer message would look like.
The message has the following layers: The message has the following layers:
o Layer 0: Has a content encrypted with AES-GCM using a 128-bit key. * Layer 0: Has a content encrypted with AES-GCM using a 128-bit key.
o Layer 1: Uses the AES Key Wrap algorithm with a 128-bit key. * Layer 1: Uses the AES Key Wrap algorithm with a 128-bit key.
o Layer 2: Uses ECDH Ephemeral-Static direct to generate the layer 1 * Layer 2: Uses ECDH Ephemeral-Static direct to generate the layer 1
key. key.
In effect, this example is a decomposed version of using the In effect, this example is a decomposed version of using the
ECDH-ES+A128KW algorithm. ECDH-ES+A128KW algorithm.
Size of binary file is 183 bytes Size of binary file is 183 bytes
96( 96(
[ [
/ protected / h'a10101' / { / protected / h'a10101' / {
\ alg \ 1:1 \ AES-GCM 128 \ \ alg \ 1:1 \ AES-GCM 128 \
} / , } / ,
/ unprotected / { / unprotected / {
/ iv / 5:h'02d1f7e6f26c43d4868d87ce' / iv / 5:h'02d1f7e6f26c43d4868d87ce'
}, },
/ ciphertext / h'64f84d913ba60a76070a9a48f26e97e863e2852948658f0 / ciphertext / h'64f84d913ba60a76070a9a48f26e97e863e2852948658f0
811139868826e89218a75715b', 811139868826e89218a75715b',
skipping to change at page 64, line 42 skipping to change at page 67, line 50
using, it may be necessary to deal with &gt; as an entity.) using, it may be necessary to deal with &gt; as an entity.)
//artwork[@type='CDDL']/text() //artwork[@type='CDDL']/text()
C.1. Examples of Signed Messages C.1. Examples of Signed Messages
C.1.1. Single Signature C.1.1. Single Signature
This example uses the following: This example uses the following:
o Signature Algorithm: ECDSA w/ SHA-256, Curve P-256 * Signature Algorithm: ECDSA w/ SHA-256, Curve P-256
Size of binary file is 103 bytes Size of binary file is 103 bytes
98( 98(
[ [
/ protected / h'', / protected / h'',
/ unprotected / {}, / unprotected / {},
/ payload / 'This is the content.', / payload / 'This is the content.',
/ signatures / [ / signatures / [
[ [
/ protected / h'a10126' / { / protected / h'a10126' / {
skipping to change at page 65, line 29 skipping to change at page 68, line 29
98f53afd2fa0f30a' 98f53afd2fa0f30a'
] ]
] ]
] ]
) )
C.1.2. Multiple Signers C.1.2. Multiple Signers
This example uses the following: This example uses the following:
o Signature Algorithm: ECDSA w/ SHA-256, Curve P-256 * Signature Algorithm: ECDSA w/ SHA-256, Curve P-256
o Signature Algorithm: ECDSA w/ SHA-512, Curve P-521 * Signature Algorithm: ECDSA w/ SHA-512, Curve P-521
Size of binary file is 277 bytes Size of binary file is 277 bytes
98( 98(
[ [
/ protected / h'', / protected / h'',
/ unprotected / {}, / unprotected / {},
/ payload / 'This is the content.', / payload / 'This is the content.',
/ signatures / [ / signatures / [
[ [
/ protected / h'a10126' / { / protected / h'a10126' / {
skipping to change at page 66, line 42 skipping to change at page 69, line 42
83ab87bb4f7a0297' 83ab87bb4f7a0297'
] ]
] ]
] ]
) )
C.1.3. Counter Signature C.1.3. Counter Signature
This example uses the following: This example uses the following:
o Signature Algorithm: ECDSA w/ SHA-256, Curve P-256 * Signature Algorithm: ECDSA w/ SHA-256, Curve P-256
o The same parameters are used for both the signature and the * The same parameters are used for both the signature and the
counter signature. counter signature.
Size of binary file is 180 bytes Size of binary file is 180 bytes
98( 98(
[ [
/ protected / h'', / protected / h'',
/ unprotected / { / unprotected / {
/ countersign / 7:[ / countersign / 7:[
/ protected / h'a10126' / { / protected / h'a10126' / {
\ alg \ 1:-7 \ ECDSA 256 \ \ alg \ 1:-7 \ ECDSA 256 \
skipping to change at page 67, line 41 skipping to change at page 70, line 41
98f53afd2fa0f30a' 98f53afd2fa0f30a'
] ]
] ]
] ]
) )
C.1.4. Signature with Criticality C.1.4. Signature with Criticality
This example uses the following: This example uses the following:
o Signature Algorithm: ECDSA w/ SHA-256, Curve P-256 * Signature Algorithm: ECDSA w/ SHA-256, Curve P-256
o There is a criticality marker on the "reserved" header parameter * There is a criticality marker on the "reserved" header parameter
Size of binary file is 125 bytes Size of binary file is 125 bytes
98( 98(
[ [
/ protected / h'a2687265736572766564f40281687265736572766564' / / protected / h'a2687265736572766564f40281687265736572766564' /
{ {
"reserved":false, "reserved":false,
\ crit \ 2:[ \ crit \ 2:[
"reserved" "reserved"
] ]
skipping to change at page 68, line 37 skipping to change at page 71, line 37
] ]
] ]
) )
C.2. Single Signer Examples C.2. Single Signer Examples
C.2.1. Single ECDSA Signature C.2.1. Single ECDSA Signature
This example uses the following: This example uses the following:
o Signature Algorithm: ECDSA w/ SHA-256, Curve P-256 * Signature Algorithm: ECDSA w/ SHA-256, Curve P-256
Size of binary file is 98 bytes Size of binary file is 98 bytes
18( 18(
[ [
/ protected / h'a10126' / { / protected / h'a10126' / {
\ alg \ 1:-7 \ ECDSA 256 \ \ alg \ 1:-7 \ ECDSA 256 \
} / , } / ,
/ unprotected / { / unprotected / {
/ kid / 4:'11' / kid / 4:'11'
}, },
skipping to change at page 69, line 25 skipping to change at page 72, line 25
a4c345cacb36' a4c345cacb36'
] ]
) )
C.3. Examples of Enveloped Messages C.3. Examples of Enveloped Messages
C.3.1. Direct ECDH C.3.1. Direct ECDH
This example uses the following: This example uses the following:
o CEK: AES-GCM w/ 128-bit key * CEK: AES-GCM w/ 128-bit key
o Recipient class: ECDH Ephemeral-Static, Curve P-256 * Recipient class: ECDH Ephemeral-Static, Curve P-256
Size of binary file is 151 bytes Size of binary file is 151 bytes
96( 96(
[ [
/ protected / h'a10101' / { / protected / h'a10101' / {
\ alg \ 1:1 \ AES-GCM 128 \ \ alg \ 1:1 \ AES-GCM 128 \
} / , } / ,
/ unprotected / { / unprotected / {
/ iv / 5:h'c9cf4df2fe6c632bf7886413' / iv / 5:h'c9cf4df2fe6c632bf7886413'
}, },
skipping to change at page 70, line 39 skipping to change at page 73, line 39
/ ciphertext / h'' / ciphertext / h''
] ]
] ]
] ]
) )
C.3.2. Direct Plus Key Derivation C.3.2. Direct Plus Key Derivation
This example uses the following: This example uses the following:
o CEK: AES-CCM w/ 128-bit key, truncate the tag to 64 bits * CEK: AES-CCM w/ 128-bit key, truncate the tag to 64 bits
o Recipient class: Use HKDF on a shared secret with the following * Recipient class: Use HKDF on a shared secret with the following
implicit fields as part of the context. implicit fields as part of the context.
* salt: "aabbccddeeffgghh" - salt: "aabbccddeeffgghh"
* PartyU identity: "lighting-client" - PartyU identity: "lighting-client"
* PartyV identity: "lighting-server" - PartyV identity: "lighting-server"
* Supplementary Public Other: "Encryption Example 02" - Supplementary Public Other: "Encryption Example 02"
Size of binary file is 91 bytes Size of binary file is 91 bytes
96( 96(
[ [
/ protected / h'a1010a' / { / protected / h'a1010a' / {
\ alg \ 1:10 \ AES-CCM-16-64-128 \ \ alg \ 1:10 \ AES-CCM-16-64-128 \
} / , } / ,
/ unprotected / { / unprotected / {
/ iv / 5:h'89f52f65a1c580933b5261a76c' / iv / 5:h'89f52f65a1c580933b5261a76c'
skipping to change at page 71, line 36 skipping to change at page 74, line 36
/ ciphertext / h'' / ciphertext / h''
] ]
] ]
] ]
) )
C.3.3. Counter Signature on Encrypted Content C.3.3. Counter Signature on Encrypted Content
This example uses the following: This example uses the following:
o CEK: AES-GCM w/ 128-bit key * CEK: AES-GCM w/ 128-bit key
o Recipient class: ECDH Ephemeral-Static, Curve P-256 * Recipient class: ECDH Ephemeral-Static, Curve P-256
Size of binary file is 326 bytes Size of binary file is 326 bytes
96( 96(
[ [
/ protected / h'a10101' / { / protected / h'a10101' / {
\ alg \ 1:1 \ AES-GCM 128 \ \ alg \ 1:1 \ AES-GCM 128 \
} / , } / ,
/ unprotected / { / unprotected / {
/ iv / 5:h'c9cf4df2fe6c632bf7886413', / iv / 5:h'c9cf4df2fe6c632bf7886413',
/ countersign / 7:[ / countersign / 7:[
skipping to change at page 73, line 9 skipping to change at page 76, line 5
/ ciphertext / h'' / ciphertext / h''
] ]
] ]
] ]
) )
C.3.4. Encrypted Content with External Data C.3.4. Encrypted Content with External Data
This example uses the following: This example uses the following:
o CEK: AES-GCM w/ 128-bit key * CEK: AES-GCM w/ 128-bit key
o Recipient class: ECDH static-Static, Curve P-256 with AES Key Wrap * Recipient class: ECDH static-Static, Curve P-256 with AES Key Wrap
o Externally Supplied AAD: h'0011bbcc22dd44ee55ff660077' * Externally Supplied AAD: h'0011bbcc22dd44ee55ff660077'
Size of binary file is 173 bytes Size of binary file is 173 bytes
96( 96(
[ [
/ protected / h'a10101' / { / protected / h'a10101' / {
\ alg \ 1:1 \ AES-GCM 128 \ \ alg \ 1:1 \ AES-GCM 128 \
} / , } / ,
/ unprotected / { / unprotected / {
/ iv / 5:h'02d1f7e6f26c43d4868d87ce' / iv / 5:h'02d1f7e6f26c43d4868d87ce'
skipping to change at page 73, line 50 skipping to change at page 76, line 46
] ]
] ]
) )
C.4. Examples of Encrypted Messages C.4. Examples of Encrypted Messages
C.4.1. Simple Encrypted Message C.4.1. Simple Encrypted Message
This example uses the following: This example uses the following:
o CEK: AES-CCM w/ 128-bit key and a 64-bit tag * CEK: AES-CCM w/ 128-bit key and a 64-bit tag
Size of binary file is 52 bytes Size of binary file is 52 bytes
16( 16(
[ [
/ protected / h'a1010a' / { / protected / h'a1010a' / {
\ alg \ 1:10 \ AES-CCM-16-64-128 \ \ alg \ 1:10 \ AES-CCM-16-64-128 \
} / , } / ,
/ unprotected / { / unprotected / {
/ iv / 5:h'89f52f65a1c580933b5261a78c' / iv / 5:h'89f52f65a1c580933b5261a78c'
}, },
/ ciphertext / h'5974e1b99a3a4cc09a659aa2e9e7fff161d38ce71cb45ce / ciphertext / h'5974e1b99a3a4cc09a659aa2e9e7fff161d38ce71cb45ce
460ffb569' 460ffb569'
] ]
) )
C.4.2. Encrypted Message with a Partial IV C.4.2. Encrypted Message with a Partial IV
This example uses the following: This example uses the following:
o CEK: AES-CCM w/ 128-bit key and a 64-bit tag * CEK: AES-CCM w/ 128-bit key and a 64-bit tag
o Prefix for IV is 89F52F65A1C580933B52 * Prefix for IV is 89F52F65A1C580933B52
Size of binary file is 41 bytes Size of binary file is 41 bytes
16( 16(
[ [
/ protected / h'a1010a' / { / protected / h'a1010a' / {
\ alg \ 1:10 \ AES-CCM-16-64-128 \ \ alg \ 1:10 \ AES-CCM-16-64-128 \
} / , } / ,
/ unprotected / { / unprotected / {
/ partial iv / 6:h'61a7' / partial iv / 6:h'61a7'
skipping to change at page 74, line 46 skipping to change at page 77, line 46
3bd09abca' 3bd09abca'
] ]
) )
C.5. Examples of MACed Messages C.5. Examples of MACed Messages
C.5.1. Shared Secret Direct MAC C.5.1. Shared Secret Direct MAC
This example uses the following: This example uses the following:
o MAC: AES-CMAC, 256-bit key, truncated to 64 bits * MAC: AES-CMAC, 256-bit key, truncated to 64 bits
o Recipient class: direct shared secret * Recipient class: direct shared secret
Size of binary file is 57 bytes Size of binary file is 57 bytes
97( 97(
[ [
/ protected / h'a1010f' / { / protected / h'a1010f' / {
\ alg \ 1:15 \ AES-CBC-MAC-256//64 \ \ alg \ 1:15 \ AES-CBC-MAC-256//64 \
} / , } / ,
/ unprotected / {}, / unprotected / {},
/ payload / 'This is the content.', / payload / 'This is the content.',
/ tag / h'9e1226ba1f81b848', / tag / h'9e1226ba1f81b848',
skipping to change at page 75, line 29 skipping to change at page 78, line 29
/ ciphertext / h'' / ciphertext / h''
] ]
] ]
] ]
) )
C.5.2. ECDH Direct MAC C.5.2. ECDH Direct MAC
This example uses the following: This example uses the following:
o MAC: HMAC w/SHA-256, 256-bit key * MAC: HMAC w/SHA-256, 256-bit key
o Recipient class: ECDH key agreement, two static keys, HKDF w/ * Recipient class: ECDH key agreement, two static keys, HKDF w/
context structure context structure
Size of binary file is 214 bytes Size of binary file is 214 bytes
97( 97(
[ [
/ protected / h'a10105' / { / protected / h'a10105' / {
\ alg \ 1:5 \ HMAC 256//256 \ \ alg \ 1:5 \ HMAC 256//256 \
} / , } / ,
/ unprotected / {}, / unprotected / {},
/ payload / 'This is the content.', / payload / 'This is the content.',
skipping to change at page 76, line 35 skipping to change at page 79, line 35
/ ciphertext / h'' / ciphertext / h''
] ]
] ]
] ]
) )
C.5.3. Wrapped MAC C.5.3. Wrapped MAC
This example uses the following: This example uses the following:
o MAC: AES-MAC, 128-bit key, truncated to 64 bits * MAC: AES-MAC, 128-bit key, truncated to 64 bits
o Recipient class: AES Key Wrap w/ a pre-shared 256-bit key * Recipient class: AES Key Wrap w/ a pre-shared 256-bit key
Size of binary file is 109 bytes Size of binary file is 109 bytes
97( 97(
[ [
/ protected / h'a1010e' / { / protected / h'a1010e' / {
\ alg \ 1:14 \ AES-CBC-MAC-128//64 \ \ alg \ 1:14 \ AES-CBC-MAC-128//64 \
} / , } / ,
/ unprotected / {}, / unprotected / {},
/ payload / 'This is the content.', / payload / 'This is the content.',
/ tag / h'36f5afaf0bab5d43', / tag / h'36f5afaf0bab5d43',
skipping to change at page 77, line 30 skipping to change at page 80, line 30
b6eb0' b6eb0'
] ]
] ]
] ]
) )
C.5.4. Multi-Recipient MACed Message C.5.4. Multi-Recipient MACed Message
This example uses the following: This example uses the following:
o MAC: HMAC w/ SHA-256, 128-bit key * MAC: HMAC w/ SHA-256, 128-bit key
o Recipient class: Uses three different methods * Recipient class: Uses three different methods
1. ECDH Ephemeral-Static, Curve P-521, AES Key Wrap w/ 128-bit 1. ECDH Ephemeral-Static, Curve P-521, AES Key Wrap w/ 128-bit
key key
2. AES Key Wrap w/ 256-bit key 2. AES Key Wrap w/ 256-bit key
Size of binary file is 309 bytes Size of binary file is 309 bytes
97( 97(
[ [
/ protected / h'a10105' / { / protected / h'a10105' / {
skipping to change at page 78, line 51 skipping to change at page 81, line 51
] ]
] ]
) )
C.6. Examples of MAC0 Messages C.6. Examples of MAC0 Messages
C.6.1. Shared Secret Direct MAC C.6.1. Shared Secret Direct MAC
This example uses the following: This example uses the following:
o MAC: AES-CMAC, 256-bit key, truncated to 64 bits * MAC: AES-CMAC, 256-bit key, truncated to 64 bits
o Recipient class: direct shared secret * Recipient class: direct shared secret
Size of binary file is 37 bytes Size of binary file is 37 bytes
17( 17(
[ [
/ protected / h'a1010f' / { / protected / h'a1010f' / {
\ alg \ 1:15 \ AES-CBC-MAC-256//64 \ \ alg \ 1:15 \ AES-CBC-MAC-256//64 \
} / , } / ,
/ unprotected / {}, / unprotected / {},
/ payload / 'This is the content.', / payload / 'This is the content.',
/ tag / h'726043745027214f' / tag / h'726043745027214f'
] ]
) )
Note that this example uses the same inputs as Appendix C.5.1. Note that this example uses the same inputs as Section c.5.1.
C.7. COSE Keys C.7. COSE Keys
C.7.1. Public Keys C.7.1. Public Keys
This is an example of a COSE Key Set. This example includes the This is an example of a COSE Key Set. This example includes the
public keys for all of the previous examples. public keys for all of the previous examples.
In order the keys are: In order the keys are:
o An EC key with a kid of "meriadoc.brandybuck@buckland.example" * An EC key with a kid of "meriadoc.brandybuck@buckland.example"
o An EC key with a kid of "peregrin.took@tuckborough.example" * An EC key with a kid of "peregrin.took@tuckborough.example"
o An EC key with a kid of "bilbo.baggins@hobbiton.example" * An EC key with a kid of "bilbo.baggins@hobbiton.example"
o An EC key with a kid of "11" * An EC key with a kid of "11"
Size of binary file is 481 bytes Size of binary file is 481 bytes
[ [
{ {
-1:1, -1:1,
-2:h'65eda5a12577c2bae829437fe338701a10aaa375e1bb5b5de108de439c0 -2:h'65eda5a12577c2bae829437fe338701a10aaa375e1bb5b5de108de439c0
8551d', 8551d',
-3:h'1e52ed75701163f7f9e40ddf9f341b3dc9ba860af7e0ca7ca7e9eecd008 -3:h'1e52ed75701163f7f9e40ddf9f341b3dc9ba860af7e0ca7ca7e9eecd008
4d19c', 4d19c',
skipping to change at page 81, line 5 skipping to change at page 84, line 5
} }
] ]
C.7.2. Private Keys C.7.2. Private Keys
This is an example of a COSE Key Set. This example includes the This is an example of a COSE Key Set. This example includes the
private keys for all of the previous examples. private keys for all of the previous examples.
In order the keys are: In order the keys are:
o An EC key with a kid of "meriadoc.brandybuck@buckland.example" * An EC key with a kid of "meriadoc.brandybuck@buckland.example"
o A shared-secret key with a kid of "our-secret" * A shared-secret key with a kid of "our-secret"
o An EC key with a kid of "peregrin.took@tuckborough.example" * An EC key with a kid of "peregrin.took@tuckborough.example"
o A shared-secret key with a kid of "018c0ae5-4d9b-471b- * A shared-secret key with a kid of "018c0ae5-4d9b-471b-
bfd6-eef314bc7037" bfd6-eef314bc7037"
o An EC key with a kid of "bilbo.baggins@hobbiton.example" * An EC key with a kid of "bilbo.baggins@hobbiton.example"
o An EC key with a kid of "11" * An EC key with a kid of "11"
Size of binary file is 816 bytes Size of binary file is 816 bytes
[ [
{ {
1:2, 1:2,
2:'meriadoc.brandybuck@buckland.example', 2:'meriadoc.brandybuck@buckland.example',
-1:1, -1:1,
-2:h'65eda5a12577c2bae829437fe338701a10aaa375e1bb5b5de108de439c0 -2:h'65eda5a12577c2bae829437fe338701a10aaa375e1bb5b5de108de439c0
8551d', 8551d',
 End of changes. 250 change blocks. 
660 lines changed or deleted 735 lines changed or added

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