draft-ietf-cose-rfc8152bis-algs-01.txt   draft-ietf-cose-rfc8152bis-algs-02.txt 
COSE Working Group J. Schaad COSE Working Group J. Schaad
Internet-Draft August Cellars Internet-Draft August Cellars
Obsoletes: 8152 (if approved) February 14, 2019 Obsoletes: 8152 (if approved) March 11, 2019
Intended status: Standards Track Intended status: Standards Track
Expires: August 18, 2019 Expires: September 12, 2019
CBOR Algorithms for Object Signing and Encryption (COSE) CBOR Object Signing and Encryption (COSE): Initial Algorithms
draft-ietf-cose-rfc8152bis-algs-01 draft-ietf-cose-rfc8152bis-algs-02
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. COSE additionally describes how to represent for serialization. COSE additionally describes how to represent
cryptographic keys using CBOR. cryptographic keys using CBOR.
In this specification the conventions for the use of a number of In this specification the conventions for the use of a number of
cryptographic algorithms with COSE. The details of the structure of cryptographic algorithms with COSE. The details of the structure of
COSE are defined in [I-D.schaad-cose-rfc8152bis-struct]. COSE are defined in [I-D.ietf-cose-rfc8152bis-struct].
This document along with [I-D.schaad-cose-rfc8152bis-struct] This document along with [I-D.ietf-cose-rfc8152bis-struct] obsoletes
obsoletes RFC8152. RFC8152.
Contributing to this document Contributing to this document
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
skipping to change at page 2, line 7 skipping to change at page 2, line 7
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 August 18, 2019. This Internet-Draft will expire on September 12, 2019.
Copyright Notice Copyright Notice
Copyright (c) 2019 IETF Trust and the persons identified as the Copyright (c) 2019 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(https://trustee.ietf.org/license-info) in effect on the date of (https://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
skipping to change at page 2, line 31 skipping to change at page 2, line 31
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1. Requirements Terminology . . . . . . . . . . . . . . . . 4 1.1. Requirements Terminology . . . . . . . . . . . . . . . . 4
1.2. Changes from RFC8152 . . . . . . . . . . . . . . . . . . 4 1.2. Changes from RFC8152 . . . . . . . . . . . . . . . . . . 4
1.3. Document Terminology . . . . . . . . . . . . . . . . . . 4 1.3. Document Terminology . . . . . . . . . . . . . . . . . . 4
1.4. CBOR Grammar . . . . . . . . . . . . . . . . . . . . . . 4 1.4. CBOR Grammar . . . . . . . . . . . . . . . . . . . . . . 4
2. Signature Algorithms . . . . . . . . . . . . . . . . . . . . 4 1.5. Examples . . . . . . . . . . . . . . . . . . . . . . . . 4
2. Signature Algorithms . . . . . . . . . . . . . . . . . . . . 5
2.1. ECDSA . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.1. ECDSA . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.1.1. Security Considerations . . . . . . . . . . . . . . . 6 2.1.1. Security Considerations . . . . . . . . . . . . . . . 6
2.2. Edwards-Curve Digital Signature Algorithms (EdDSAs) . . . 7 2.2. Edwards-Curve Digital Signature Algorithms (EdDSAs) . . . 7
2.2.1. Security Considerations . . . . . . . . . . . . . . . 8 2.2.1. Security Considerations . . . . . . . . . . . . . . . 8
3. Message Authentication Code (MAC) Algorithms . . . . . . . . 8 3. Message Authentication Code (MAC) Algorithms . . . . . . . . 8
3.1. Hash-Based Message Authentication Codes (HMACs) . . . . . 8 3.1. Hash-Based Message Authentication Codes (HMACs) . . . . . 9
3.1.1. Security Considerations . . . . . . . . . . . . . . . 10 3.1.1. Security Considerations . . . . . . . . . . . . . . . 10
3.2. AES Message Authentication Code (AES-CBC-MAC) . . . . . . 10 3.2. AES Message Authentication Code (AES-CBC-MAC) . . . . . . 10
3.2.1. Security Considerations . . . . . . . . . . . . . . . 11 3.2.1. Security Considerations . . . . . . . . . . . . . . . 11
4. Content Encryption Algorithms . . . . . . . . . . . . . . . . 11 4. Content Encryption Algorithms . . . . . . . . . . . . . . . . 12
4.1. AES GCM . . . . . . . . . . . . . . . . . . . . . . . . . 11 4.1. AES GCM . . . . . . . . . . . . . . . . . . . . . . . . . 12
4.1.1. Security Considerations . . . . . . . . . . . . . . . 12 4.1.1. Security Considerations . . . . . . . . . . . . . . . 13
4.2. AES CCM . . . . . . . . . . . . . . . . . . . . . . . . . 13 4.2. AES CCM . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.2.1. Security Considerations . . . . . . . . . . . . . . . 15 4.2.1. Security Considerations . . . . . . . . . . . . . . . 16
4.3. ChaCha20 and Poly1305 . . . . . . . . . . . . . . . . . . 15 4.3. ChaCha20 and Poly1305 . . . . . . . . . . . . . . . . . . 16
4.3.1. Security Considerations . . . . . . . . . . . . . . . 16 4.3.1. Security Considerations . . . . . . . . . . . . . . . 17
5. Key Derivation Functions (KDFs) . . . . . . . . . . . . . . . 16 5. Key Derivation Functions (KDFs) . . . . . . . . . . . . . . . 17
5.1. HMAC-Based Extract-and-Expand Key Derivation Function 5.1. HMAC-Based Extract-and-Expand Key Derivation Function
(HKDF) . . . . . . . . . . . . . . . . . . . . . . . . . 16 (HKDF) . . . . . . . . . . . . . . . . . . . . . . . . . 18
5.2. Context Information Structure . . . . . . . . . . . . . . 18
6. Content Key Distribution Methods . . . . . . . . . . . . . . 23 5.2. Context Information Structure . . . . . . . . . . . . . . 19
6.1. Direct Key . . . . . . . . . . . . . . . . . . . . . . . 23 6. Content Key Distribution Methods . . . . . . . . . . . . . . 24
6.1.1. Security Considerations . . . . . . . . . . . . . . . 24 6.1. Direct Encryption . . . . . . . . . . . . . . . . . . . . 24
6.2. Direct Key with KDF . . . . . . . . . . . . . . . . . . . 24 6.1.1. Direct Key . . . . . . . . . . . . . . . . . . . . . 24
6.2.1. Security Considerations . . . . . . . . . . . . . . . 25 6.1.2. Direct Key with KDF . . . . . . . . . . . . . . . . . 25
6.3. AES Key Wrap . . . . . . . . . . . . . . . . . . . . . . 26 6.2. AES Key Wrap . . . . . . . . . . . . . . . . . . . . . . 27
6.3.1. Security Considerations for AES-KW . . . . . . . . . 27 6.2.1. Security Considerations for AES-KW . . . . . . . . . 28
6.4. Direct ECDH . . . . . . . . . . . . . . . . . . . . . . . 27 6.3. Direct ECDH . . . . . . . . . . . . . . . . . . . . . . . 28
6.4.1. Security Considerations . . . . . . . . . . . . . . . 29 6.3.1. Security Considerations . . . . . . . . . . . . . . . 30
6.5. ECDH with Key Wrap . . . . . . . . . . . . . . . . . . . 30 6.4. ECDH with Key Wrap . . . . . . . . . . . . . . . . . . . 31
7. Key Object Parameters . . . . . . . . . . . . . . . . . . . . 32 7. Key Object Parameters . . . . . . . . . . . . . . . . . . . . 33
7.1. Elliptic Curve Keys . . . . . . . . . . . . . . . . . . . 32 7.1. Elliptic Curve Keys . . . . . . . . . . . . . . . . . . . 33
7.1.1. Double Coordinate Curves . . . . . . . . . . . . . . 33 7.1.1. Double Coordinate Curves . . . . . . . . . . . . . . 34
7.2. Octet Key Pair . . . . . . . . . . . . . . . . . . . . . 34 7.2. Octet Key Pair . . . . . . . . . . . . . . . . . . . . . 35
7.3. Symmetric Keys . . . . . . . . . . . . . . . . . . . . . 35 7.3. Symmetric Keys . . . . . . . . . . . . . . . . . . . . . 36
8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 35 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 36
8.1. COSE Algorithms Registry . . . . . . . . . . . . . . . . 35 9. Security Considerations . . . . . . . . . . . . . . . . . . . 36
8.2. COSE Key Type Parameters Registry . . . . . . . . . . . . 36 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 38
8.3. COSE Key Types Registry . . . . . . . . . . . . . . . . . 36 10.1. Normative References . . . . . . . . . . . . . . . . . . 38
8.4. COSE Elliptic Curves Registry . . . . . . . . . . . . . . 37 10.2. Informative References . . . . . . . . . . . . . . . . . 40
8.5. Expert Review Instructions . . . . . . . . . . . . . . . 37 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 42
9. Security Considerations . . . . . . . . . . . . . . . . . . . 38 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 42
10. References . . . . . . . . . . . . . . . . . . . . . . . . . 40
10.1. Normative References . . . . . . . . . . . . . . . . . . 40
10.2. Informative References . . . . . . . . . . . . . . . . . 42
Appendix A. Examples . . . . . . . . . . . . . . . . . . . . . . 43
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 43
Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 44
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 is being adopted by several of the IETF working other changes. CBOR is being 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
structures. CBOR was designed specifically to be both small in terms structures. CBOR was designed specifically to be both small in terms
of messages transport and implementation size and be a schema-free of messages transport and implementation size and be a schema-free
decoder. A need exists to provide message security services for IoT, decoder. A need exists to provide message security services for IoT,
and using CBOR as the message-encoding format makes sense. and using CBOR as the message-encoding format makes sense.
The core COSE specification consists of two documents. The core COSE specification consists of two documents.
[I-D.schaad-cose-rfc8152bis-struct] contains the serialization [I-D.ietf-cose-rfc8152bis-struct] contains the serialization
structures and the procedures for using the different cryptographic structures and the procedures for using the different cryptographic
algorithms. This document provides for an initial set of algorithms algorithms. This document provides for an initial set of algorithms
that are then use with those structures. Additional algorithms that are then use with those structures. Additional algorithms
beyond what are in this document are defined elsewhere. beyond what are in this document are defined elsewhere.
1.1. Requirements Terminology 1.1. Requirements Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in BCP "OPTIONAL" in this document are to be interpreted as described in BCP
14 [RFC2119] [RFC8174] when, and only when, they appear in all 14 [RFC2119] [RFC8174] when, and only when, they appear in all
capitals, as shown here. capitals, as shown here.
1.2. Changes from RFC8152 1.2. Changes from RFC8152
TBD o Extract the sections dealing with specific algorithms into this
document. The sections dealing with structure and general
processing rules are placed in [I-D.ietf-cose-rfc8152bis-struct].
1.3. Document Terminology 1.3. Document Terminology
In this document, we use the following terminology: In this document, we use the following terminology:
Byte is a synonym for octet. Byte is a synonym for octet.
Constrained Application Protocol (CoAP) is a specialized web transfer Constrained Application Protocol (CoAP) is a specialized web transfer
protocol for use in constrained systems. It is defined in [RFC7252]. protocol for use in constrained systems. It is defined in [RFC7252].
skipping to change at page 4, line 42 skipping to change at page 4, line 42
Authenticated Encryption with Authenticated Data (AEAD) [RFC5116] Authenticated Encryption with Authenticated Data (AEAD) [RFC5116]
algorithms provide the same content authentication service as AE algorithms provide the same content authentication service as AE
algorithms, but they additionally provide for authentication of non- algorithms, but they additionally provide for authentication of non-
encrypted data as well. encrypted data as well.
1.4. CBOR Grammar 1.4. CBOR Grammar
At the time that [RFC8152] was initially published, the CBOR Data At the time that [RFC8152] was initially published, the CBOR Data
Definition Language (CDDL) [I-D.ietf-cbor-cddl] had not yet been Definition Language (CDDL) [I-D.ietf-cbor-cddl] had not yet been
published. This document uses a variant of CDDL which is described published. This document uses a variant of CDDL which is described
in [I-D.schaad-cose-rfc8152bis-struct] in [I-D.ietf-cose-rfc8152bis-struct]
1.5. Examples
A GitHub project has been created at <https://github.com/cose-wg/
Examples> that contains not only the examples presented in this
document, but a more complete set of testing examples as well. Each
example is found in a JSON file that contains the inputs used to
create the example, some of the intermediate values that can be used
in debugging the example and the output of the example presented in
both a hex and a CBOR diagnostic notation format. Some of the
examples at the site are designed failure testing cases; these are
clearly marked as such in the JSON file. If errors in the examples
in this document are found, the examples on GitHub will be updated,
and a note to that effect will be placed in the JSON file.
2. Signature Algorithms 2. Signature Algorithms
The document defines signature algorithm identifiers for two Section X.X of [I-D.ietf-cose-rfc8152bis-struct]
signature algorithms. [I-D.ietf-cose-rfc8152bis-struct] contains a generic description of
signature algorithms. The document defines signature algorithm
identifiers for two signature algorithms.
2.1. ECDSA 2.1. ECDSA
ECDSA [DSS] defines a signature algorithm using ECC. Implementations ECDSA [DSS] defines a signature algorithm using ECC. Implementations
SHOULD use a deterministic version of ECDSA such as the one defined SHOULD use a deterministic version of ECDSA such as the one defined
in [RFC6979]. The use of a deterministic signature algorithm allows in [RFC6979]. The use of a deterministic signature algorithm allows
for systems to avoid relying on random number generators in order to for systems to avoid relying on random number generators in order to
avoid generating the same value of 'k' (the per-message random avoid generating the same value of 'k' (the per-message random
value). Biased generation of the value 'k' can be attacked, and value). Biased generation of the value 'k' can be attacked, and
collisions of this value leads to leaked keys. It additionally collisions of this value leads to leaked keys. It additionally
skipping to change at page 8, line 32 skipping to change at page 8, line 45
and Elliptic Curve Diffie-Hellman (ECDH); for this reason, they and Elliptic Curve Diffie-Hellman (ECDH); for this reason, they
should not be used with the other algorithm. should not be used with the other algorithm.
If batch signature verification is performed, a well-seeded If batch signature verification is performed, a well-seeded
cryptographic random number generator is REQUIRED. Signing and non- cryptographic random number generator is REQUIRED. Signing and non-
batch signature verification are deterministic operations and do not batch signature verification are deterministic operations and do not
need random numbers of any kind. need random numbers of any kind.
3. Message Authentication Code (MAC) Algorithms 3. Message Authentication Code (MAC) Algorithms
This section defines the usages for two MAC algorithms. Section X.X of [I-D.ietf-cose-rfc8152bis-struct]
[I-D.ietf-cose-rfc8152bis-struct] contains a generic description of
MAC algorithms. This section defines the conventions for two MAC
algorithms.
3.1. Hash-Based Message Authentication Codes (HMACs) 3.1. Hash-Based Message Authentication Codes (HMACs)
HMAC [RFC2104] [RFC4231] was designed to deal with length extension HMAC [RFC2104] [RFC4231] was designed to deal with length extension
attacks. The algorithm was also designed to allow for new hash attacks. The algorithm was also designed to allow for new hash
algorithms to be directly plugged in without changes to the hash algorithms to be directly plugged in without changes to the hash
function. The HMAC design process has been shown as solid since, function. The HMAC design process has been shown as solid since,
while the security of hash algorithms such as MD5 has decreased over while the security of hash algorithms such as MD5 has decreased over
time; the security of HMAC combined with MD5 has not yet been shown time; the security of HMAC combined with MD5 has not yet been shown
to be compromised [RFC6151]. to be compromised [RFC6151].
skipping to change at page 11, line 33 skipping to change at page 12, line 14
o Cipher Block Chaining (CBC) mode, if the same key is used for both o Cipher Block Chaining (CBC) mode, if the same key is used for both
encryption and authentication operations, an attacker can produce encryption and authentication operations, an attacker can produce
messages with a valid authentication code. messages with a valid authentication code.
o If the IV can be modified, then messages can be forged. This is o If the IV can be modified, then messages can be forged. This is
addressed by fixing the IV to all zeros. addressed by fixing the IV to all zeros.
4. Content Encryption Algorithms 4. Content Encryption Algorithms
This document defines the identifier and usages for three content Section X.X of [I-D.ietf-cose-rfc8152bis-struct]
encryption algorithms. [I-D.ietf-cose-rfc8152bis-struct] contains a generic description of
Content Encryption algorithms. This document defines the identifier
and usages for three content encryption algorithms.
4.1. AES GCM 4.1. AES GCM
The Galois/Counter Mode (GCM) mode is a generic authenticated The Galois/Counter Mode (GCM) mode is a generic authenticated
encryption block cipher mode defined in [AES-GCM]. The GCM mode is encryption block cipher mode defined in [AES-GCM]. The GCM mode is
combined with the AES block encryption algorithm to define an AEAD combined with the AES block encryption algorithm to define an AEAD
cipher. cipher.
The GCM mode is parameterized by the size of the authentication tag The GCM mode is parameterized by the size of the authentication tag
and the size of the nonce. This document fixes the size of the nonce and the size of the nonce. This document fixes the size of the nonce
skipping to change at page 16, line 41 skipping to change at page 17, line 41
'unwrap key' when decrypting. 'unwrap key' when decrypting.
4.3.1. Security Considerations 4.3.1. Security Considerations
The key and nounce values MUST be a unique pair for every invocation The key and nounce values MUST be a unique pair for every invocation
of the algorithm. Nonce counters are considered to be an acceptable of the algorithm. Nonce counters are considered to be an acceptable
way of ensuring that they are unique. way of ensuring that they are unique.
5. Key Derivation Functions (KDFs) 5. Key Derivation Functions (KDFs)
This document defines a single context structure and a single KDF. Section X.X of [I-D.ietf-cose-rfc8152bis-struct]
These elements are used for all of the recipient algorithms defined [I-D.ietf-cose-rfc8152bis-struct] contains a generic description of
in this document that require a KDF process. These algorithms are Key Derivation Functions. This document defines a single context
defined in Sections 6.2, 6.4, and 6.5. structure and a single KDF. These elements are used for all of the
recipient algorithms defined in this document that require a KDF
process. These algorithms are defined in Sections 6.1.2, 6.3, and
6.4.
5.1. HMAC-Based Extract-and-Expand Key Derivation Function (HKDF) 5.1. HMAC-Based Extract-and-Expand Key Derivation Function (HKDF)
The HKDF key derivation algorithm is defined in [RFC5869]. The HKDF key derivation algorithm is defined in [RFC5869].
The HKDF algorithm takes these inputs: The HKDF algorithm takes these inputs:
secret -- a shared value that is secret. Secrets may be either secret -- a shared value that is secret. Secrets may be either
previously shared or derived from operations like a Diffie-Hellman previously shared or derived from operations like a Diffie-Hellman
(DH) key agreement. (DH) key agreement.
skipping to change at page 23, line 33 skipping to change at page 24, line 33
SuppPubInfo : [ SuppPubInfo : [
keyDataLength : uint, keyDataLength : uint,
protected : empty_or_serialized_map, protected : empty_or_serialized_map,
? other : bstr ? other : bstr
], ],
? SuppPrivInfo : bstr ? SuppPrivInfo : bstr
] ]
6. Content Key Distribution Methods 6. Content Key Distribution Methods
This document defines the identifiers and usage for a number of Section X.X of [I-D.ietf-cose-rfc8152bis-struct]
content key distribution methods. [I-D.ietf-cose-rfc8152bis-struct] contains a generic description of
content key distribution methods. This document defines the
identifiers and usage for a number of content key distribution
methods.
6.1. Direct Key 6.1. Direct Encryption
Direct encryption algorithm is defined in Section X.X of [I-D.ietf-
cose-rfc8152bis-struct] [I-D.ietf-cose-rfc8152bis-struct].
Information about how to fill in the COSE_Recipient structure are
detailed there.
6.1.1. Direct Key
This recipient algorithm is the simplest; the identified key is This recipient algorithm is the simplest; the identified key is
directly used as the key for the next layer down in the message. directly used as the key for the next layer down in the message.
There are no algorithm parameters defined for this algorithm. The There are no algorithm parameters defined for this algorithm. The
algorithm identifier value is assigned in Table 11. algorithm identifier value is assigned in Table 11.
When this algorithm is used, the protected field MUST be zero length. When this algorithm is used, the protected field MUST be zero length.
The key type MUST be 'Symmetric'. The key type MUST be 'Symmetric'.
+--------+-------+-------------------+ +--------+-------+-------------------+
| Name | Value | Description | | Name | Value | Description |
+--------+-------+-------------------+ +--------+-------+-------------------+
| direct | -6 | Direct use of CEK | | direct | -6 | Direct use of CEK |
+--------+-------+-------------------+ +--------+-------+-------------------+
Table 11: Direct Key Table 11: Direct Key
6.1.1. Security Considerations 6.1.1.1. Security Considerations
This recipient algorithm has several potential problems that need to This recipient algorithm has several potential problems that need to
be considered: be considered:
o These keys need to have some method to be regularly updated over o These keys need to have some method to be regularly updated over
time. All of the content encryption algorithms specified in this time. All of the content encryption algorithms specified in this
document have limits on how many times a key can be used without document have limits on how many times a key can be used without
significant loss of security. significant loss of security.
o These keys need to be dedicated to a single algorithm. There have o These keys need to be dedicated to a single algorithm. There have
been a number of attacks developed over time when a single key is been a number of attacks developed over time when a single key is
used for multiple different algorithms. One example of this is used for multiple different algorithms. One example of this is
the use of a single key for both the CBC encryption mode and the the use of a single key for both the CBC encryption mode and the
CBC-MAC authentication mode. CBC-MAC authentication mode.
o Breaking one message means all messages are broken. If an o Breaking one message means all messages are broken. If an
adversary succeeds in determining the key for a single message, adversary succeeds in determining the key for a single message,
then the key for all messages is also determined. then the key for all messages is also determined.
6.2. Direct Key with KDF 6.1.2. Direct Key with KDF
These recipient algorithms take a common shared secret between the These recipient algorithms take a common shared secret between the
two parties and applies the HKDF function (Section 5.1), using the two parties and applies the HKDF function (Section 5.1), using the
context structure defined in Section 5.2 to transform the shared context structure defined in Section 5.2 to transform the shared
secret into the CEK. The 'protected' field can be of non-zero secret into the CEK. The 'protected' field can be of non-zero
length. Either the 'salt' parameter of HKDF or the 'PartyU nonce' length. Either the 'salt' parameter of HKDF or the 'PartyU nonce'
parameter of the context structure MUST be present. The salt/nonce parameter of the context structure MUST be present. The salt/nonce
parameter can be generated either randomly or deterministically. The parameter can be generated either randomly or deterministically. The
requirement is that it be a unique value for the shared secret in requirement is that it be a unique value for the shared secret in
question. question.
skipping to change at page 25, line 45 skipping to change at page 26, line 48
made: made:
o The 'kty' field MUST be present, and it MUST be 'Symmetric'. o The 'kty' field MUST be present, and it MUST be 'Symmetric'.
o If the 'alg' field is present, it MUST match the algorithm being o If the 'alg' field is present, it MUST match the algorithm being
used. used.
o If the 'key_ops' field is present, it MUST include 'deriveKey' or o If the 'key_ops' field is present, it MUST include 'deriveKey' or
'deriveBits'. 'deriveBits'.
6.2.1. Security Considerations 6.1.2.1. Security Considerations
The shared secret needs to have some method to be regularly updated The shared secret needs to have some method to be regularly updated
over time. The shared secret forms the basis of trust. Although not over time. The shared secret forms the basis of trust. Although not
used directly, it should still be subject to scheduled rotation. used directly, it should still be subject to scheduled rotation.
While these methods do not provide for perfect forward secrecy, as While these methods do not provide for perfect forward secrecy, as
the same shared secret is used for all of the keys generated, if the the same shared secret is used for all of the keys generated, if the
key for any single message is discovered, only the message (or series key for any single message is discovered, only the message (or series
of messages) using that derived key are compromised. A new key of messages) using that derived key are compromised. A new key
derivation step will generate a new key that requires the same amount derivation step will generate a new key that requires the same amount
of work to get the key. of work to get the key.
6.3. AES Key Wrap 6.2. AES Key Wrap
The AES Key Wrap algorithm is defined in [RFC3394]. This algorithm The AES Key Wrap algorithm is defined in [RFC3394]. This algorithm
uses an AES key to wrap a value that is a multiple of 64 bits. As uses an AES key to wrap a value that is a multiple of 64 bits. As
such, it can be used to wrap a key for any of the content encryption such, it can be used to wrap a key for any of the content encryption
algorithms defined in this document. The algorithm requires a single algorithms defined in this document. The algorithm requires a single
fixed parameter, the initial value. This is fixed to the value fixed parameter, the initial value. This is fixed to the value
specified in Section 2.2.3.1 of [RFC3394]. There are no public specified in Section 2.2.3.1 of [RFC3394]. There are no public
parameters that vary on a per-invocation basis. The protected header parameters that vary on a per-invocation basis. The protected header
field MUST be empty. field MUST be empty.
skipping to change at page 27, line 5 skipping to change at page 28, line 5
+--------+-------+----------+-----------------------------+ +--------+-------+----------+-----------------------------+
| Name | Value | Key Size | Description | | Name | Value | Key Size | Description |
+--------+-------+----------+-----------------------------+ +--------+-------+----------+-----------------------------+
| A128KW | -3 | 128 | AES Key Wrap w/ 128-bit key | | A128KW | -3 | 128 | AES Key Wrap w/ 128-bit key |
| A192KW | -4 | 192 | AES Key Wrap w/ 192-bit key | | A192KW | -4 | 192 | AES Key Wrap w/ 192-bit key |
| A256KW | -5 | 256 | AES Key Wrap w/ 256-bit key | | A256KW | -5 | 256 | AES Key Wrap w/ 256-bit key |
+--------+-------+----------+-----------------------------+ +--------+-------+----------+-----------------------------+
Table 13: AES Key Wrap Algorithm Values Table 13: AES Key Wrap Algorithm Values
6.3.1. Security Considerations for AES-KW 6.2.1. Security Considerations for AES-KW
The shared secret needs to have some method to be regularly updated The shared secret needs to have some method to be regularly updated
over time. The shared secret is the basis of trust. over time. The shared secret is the basis of trust.
6.4. Direct ECDH 6.3. Direct ECDH
The mathematics for ECDH can be found in [RFC6090]. In this The mathematics for ECDH can be found in [RFC6090]. In this
document, the algorithm is extended to be used with the two curves document, the algorithm is extended to be used with the two curves
defined in [RFC7748]. defined in [RFC7748].
ECDH is parameterized by the following: ECDH is parameterized by the following:
o Curve Type/Curve: The curve selected controls not only the size of o Curve Type/Curve: The curve selected controls not only the size of
the shared secret, but the mathematics for computing the shared the shared secret, but the mathematics for computing the shared
secret. The curve selected also controls how a point in the curve secret. The curve selected also controls how a point in the curve
skipping to change at page 29, line 47 skipping to change at page 30, line 47
o If the 'alg' field is present, it MUST match the key agreement o If the 'alg' field is present, it MUST match the key agreement
algorithm being used. algorithm being used.
o If the 'key_ops' field is present, it MUST include 'derive key' or o If the 'key_ops' field is present, it MUST include 'derive key' or
'derive bits' for the private key. 'derive bits' for the private key.
o If the 'key_ops' field is present, it MUST be empty for the public o If the 'key_ops' field is present, it MUST be empty for the public
key. key.
6.4.1. Security Considerations 6.3.1. Security Considerations
There is a method of checking that points provided from external There is a method of checking that points provided from external
entities are valid. For the 'EC2' key format, this can be done by entities are valid. For the 'EC2' key format, this can be done by
checking that the x and y values form a point on the curve. For the checking that the x and y values form a point on the curve. For the
'OKP' format, there is no simple way to do point validation. 'OKP' format, there is no simple way to do point validation.
Consideration was given to requiring that the public keys of both Consideration was given to requiring that the public keys of both
entities be provided as part of the key derivation process (as entities be provided as part of the key derivation process (as
recommended in Section 6.1 of [RFC7748]). This was not done as COSE recommended in Section 6.1 of [RFC7748]). This was not done as COSE
is used in a store and forward format rather than in online key is used in a store and forward format rather than in online key
exchange. In order for this to be a problem, either the receiver exchange. In order for this to be a problem, either the receiver
public key has to be chosen maliciously or the sender has to be public key has to be chosen maliciously or the sender has to be
malicious. In either case, all security evaporates anyway. malicious. In either case, all security evaporates anyway.
A proof of possession of the private key associated with the public A proof of possession of the private key associated with the public
key is recommended when a key is moved from untrusted to trusted key is recommended when a key is moved from untrusted to trusted
(either by the end user or by the entity that is responsible for (either by the end user or by the entity that is responsible for
making trust statements on keys). making trust statements on keys).
6.5. ECDH with Key Wrap 6.4. ECDH with Key Wrap
These algorithms are defined in Table 16. These algorithms are defined in Table 16.
ECDH with Key Agreement is parameterized by the same parameters as ECDH with Key Agreement is parameterized by the same parameters as
for ECDH; see Section 6.4, with the following modifications: for ECDH; see Section 6.3, with the following modifications:
o Key Wrap Algorithm: Any of the key wrap algorithms defined in o Key Wrap Algorithm: Any of the key wrap algorithms defined in
Section 6.3 are supported. The size of the key used for the key Section 6.2 are supported. The size of the key used for the key
wrap algorithm is fed into the KDF. The set of identifiers are wrap algorithm is fed into the KDF. The set of identifiers are
found in Table 16. found in Table 16.
+-----------+-------+---------+------------+--------+---------------+ +-----------+-------+---------+------------+--------+---------------+
| Name | Value | KDF | Ephemeral- | Key | Description | | Name | Value | KDF | Ephemeral- | Key | Description |
| | | | Static | Wrap | | | | | | Static | Wrap | |
+-----------+-------+---------+------------+--------+---------------+ +-----------+-------+---------+------------+--------+---------------+
| ECDH-ES + | -29 | HKDF - | yes | A128KW | ECDH ES w/ | | ECDH-ES + | -29 | HKDF - | yes | A128KW | ECDH ES w/ |
| A128KW | | SHA-256 | | | Concat KDF | | A128KW | | SHA-256 | | | Concat KDF |
| | | | | | and AES Key | | | | | | | and AES Key |
skipping to change at page 35, line 12 skipping to change at page 36, line 12
structure. For private keys, it is REQUIRED that 'crv' and 'd' be structure. For private keys, it is REQUIRED that 'crv' and 'd' be
present in the structure. For private keys, it is RECOMMENDED that present in the structure. For private keys, it is RECOMMENDED that
'x' also be present, but it can be recomputed from the required 'x' also be present, but it can be recomputed from the required
elements and omitting it saves on space. elements and omitting it saves on space.
+------+-------+-------+--------+-----------------------------------+ +------+-------+-------+--------+-----------------------------------+
| Name | Key | Label | Type | Description | | Name | Key | Label | Type | Description |
| | Type | | | | | | Type | | | |
+------+-------+-------+--------+-----------------------------------+ +------+-------+-------+--------+-----------------------------------+
| crv | 1 | -1 | int / | EC identifier - Taken from the | | crv | 1 | -1 | int / | EC identifier - Taken from the |
| | | | tstr | "COSE Key Common Parameters" | | | | | tstr | "COSE Elliptic Curves" registry |
| | | | | registry |
| x | 1 | -2 | bstr | x-coordinate | | x | 1 | -2 | bstr | x-coordinate |
| d | 1 | -4 | bstr | Private key | | d | 1 | -4 | bstr | Private key |
+------+-------+-------+--------+-----------------------------------+ +------+-------+-------+--------+-----------------------------------+
Table 20: Octet Key Pair Parameters Table 20: Octet Key Pair Parameters
7.3. Symmetric Keys 7.3. Symmetric Keys
Occasionally it is required that a symmetric key be transported Occasionally it is required that a symmetric key be transported
between entities. This key structure allows for that to happen. between entities. This key structure allows for that to happen.
skipping to change at page 35, line 46 skipping to change at page 36, line 45
+------+----------+-------+------+-------------+ +------+----------+-------+------+-------------+
| Name | Key Type | Label | Type | Description | | Name | Key Type | Label | Type | Description |
+------+----------+-------+------+-------------+ +------+----------+-------+------+-------------+
| k | 4 | -1 | bstr | Key Value | | k | 4 | -1 | bstr | Key Value |
+------+----------+-------+------+-------------+ +------+----------+-------+------+-------------+
Table 21: Symmetric Key Parameters Table 21: Symmetric Key Parameters
8. IANA Considerations 8. IANA Considerations
8.1. COSE Algorithms Registry There are no IANA actions.
IANA created and populated the "COSE Algorithms" registry as part of
processing processing [RFC8152]. IANA is requested to update the for
individual algorithms from [RFC8152] to this document.
This document does not modify the guidance for designated experts.
8.2. COSE Key Type Parameters Registry
IANA has created a new registry titled "COSE Key Type Parameters".
The registry has been created to use the "Expert Review Required"
registration procedure. Expert review guidelines are provided in
Section 8.5.
The columns of the table are:
Key Type: This field contains a descriptive string of a key type.
This should be a value that is in the "COSE Key Common Parameters"
registry and is placed in the 'kty' field of a COSE Key structure.
Name: This is a descriptive name that enables easier reference to
the item. It is not used in the encoding.
Label: The label is to be unique for every value of key type. The
range of values is from -65536 to -1. Labels are expected to be
reused for different keys.
CBOR Type: This field contains the CBOR type for the field.
Description: This field contains a brief description for the field.
Reference: This contains a pointer to the public specification for
the field if one exists.
This registry has been initially populated by the values in Tables
19, 20, and 21. All of the entries in the "References" column of
this registry point to this document.
8.3. COSE Key Types Registry
IANA has created a new registry titled "COSE Key Types". The
registry has been created to use the "Expert Review Required"
registration procedure. Expert review guidelines are provided in
Section 8.5.
The columns of this table are:
Name: This is a descriptive name that enables easier reference to
the item. The name MUST be unique. It is not used in the
encoding.
Value: This is the value used to identify the curve. These values
MUST be unique. The value can be a positive integer, a negative
integer, or a string.
Description: This field contains a brief description of the curve.
References: This contains a pointer to the public specification for
the curve if one exists.
This registry has been initially populated by the values in Table 17.
The specification column for all of these entries will be this
document.
8.4. COSE Elliptic Curves Registry
IANA created and populated the "COSE Elliptic Curves" registry as
part of processing [RFC8152]. IANA is requested to change the
reference from [RFC8152] to this document for all values in the
registry.
This document does not change the guidance for Designated Experts.
8.5. Expert Review Instructions
All of the IANA registries established in this document are defined
as expert review. This section gives some general guidelines for
what the experts should be looking for, but they are being designated
as experts for a reason, so they should be given substantial
latitude.
Expert reviewers should take into consideration the following points:
o Point squatting should be discouraged. Reviewers are encouraged
to get sufficient information for registration requests to ensure
that the usage is not going to duplicate one that is already
registered, and that the point is likely to be used in
deployments. The zones tagged as private use are intended for
testing purposes and closed environments; code points in other
ranges should not be assigned for testing.
o Specifications are required for the standards track range of point
assignment. Specifications should exist for specification
required ranges, but early assignment before a specification is
available is considered to be permissible. Specifications are
needed for the first-come, first-serve range if they are expected
to be used outside of closed environments in an interoperable way.
When specifications are not provided, the description provided
needs to have sufficient information to identify what the point is
being used for.
o Experts should take into account the expected usage of fields when
approving point assignment. The fact that there is a range for
standards track documents does not mean that a standards track
document cannot have points assigned outside of that range. The
length of the encoded value should be weighed against how many
code points of that length are left, the size of device it will be
used on, and the number of code points left that encode to that
size.
o When algorithms are registered, vanity registrations should be
discouraged. One way to do this is to require registrations to
provide additional documentation on security analysis of the
algorithm. Another thing that should be considered is requesting
an opinion on the algorithm from the Crypto Forum Research Group
(CFRG). Algorithms that do not meet the security requirements of
the community and the messages structures should not be
registered.
9. Security Considerations 9. Security Considerations
There are a number of security considerations that need to be taken There are a number of security considerations that need to be taken
into account by implementers of this specification. The security into account by implementers of this specification. The security
considerations that are specific to an individual algorithm are considerations that are specific to an individual algorithm are
placed next to the description of the algorithm. While some placed next to the description of the algorithm. While some
considerations have been highlighted here, additional considerations considerations have been highlighted here, additional considerations
may be found in the documents listed in the references. may be found in the documents listed in the references.
skipping to change at page 40, line 39 skipping to change at page 39, line 18
Publication 800-38D, DOI 10.6028/NIST.SP.800-38D, November Publication 800-38D, DOI 10.6028/NIST.SP.800-38D, November
2007, <https://csrc.nist.gov/publications/nistpubs/800- 2007, <https://csrc.nist.gov/publications/nistpubs/800-
38D/SP-800-38D.pdf>. 38D/SP-800-38D.pdf>.
[DSS] National Institute of Standards and Technology, "Digital [DSS] National Institute of Standards and Technology, "Digital
Signature Standard (DSS)", FIPS PUB 186-4, Signature Standard (DSS)", FIPS PUB 186-4,
DOI 10.6028/NIST.FIPS.186-4, July 2013, DOI 10.6028/NIST.FIPS.186-4, July 2013,
<http://nvlpubs.nist.gov/nistpubs/FIPS/ <http://nvlpubs.nist.gov/nistpubs/FIPS/
NIST.FIPS.186-4.pdf>. NIST.FIPS.186-4.pdf>.
[I-D.schaad-cose-rfc8152bis-struct] [I-D.ietf-cose-rfc8152bis-struct]
Schaad, J., "CBOR Object Signing and Encryption (COSE) - Schaad, J., "CBOR Object Signing and Encryption (COSE) -
Structures and Process", draft-schaad-cose-rfc8152bis- Structures and Process", draft-ietf-cose-rfc8152bis-
struct-01 (work in progress), December 2018. struct-01 (work in progress), February 2019.
[MAC] National Institute of Standards and Technology, "Computer [MAC] National Institute of Standards and Technology, "Computer
Data Authentication", FIPS PUB 113, May 1985, Data Authentication", FIPS PUB 113, May 1985,
<http://csrc.nist.gov/publications/fips/fips113/ <http://csrc.nist.gov/publications/fips/fips113/
fips113.html>. fips113.html>.
[RFC2104] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed- [RFC2104] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed-
Hashing for Message Authentication", RFC 2104, Hashing for Message Authentication", RFC 2104,
DOI 10.17487/RFC2104, February 1997, DOI 10.17487/RFC2104, February 1997,
<https://www.rfc-editor.org/info/rfc2104>. <https://www.rfc-editor.org/info/rfc2104>.
skipping to change at page 43, line 32 skipping to change at page 42, line 14
[SP800-56A] [SP800-56A]
Barker, E., Chen, L., Roginsky, A., and M. Smid, Barker, E., Chen, L., Roginsky, A., and M. Smid,
"Recommendation for Pair-Wise Key Establishment Schemes "Recommendation for Pair-Wise Key Establishment Schemes
Using Discrete Logarithm Cryptography", NIST Special Using Discrete Logarithm Cryptography", NIST Special
Publication 800-56A, Revision 2, Publication 800-56A, Revision 2,
DOI 10.6028/NIST.SP.800-56Ar2, May 2013, DOI 10.6028/NIST.SP.800-56Ar2, May 2013,
<http://nvlpubs.nist.gov/nistpubs/SpecialPublications/ <http://nvlpubs.nist.gov/nistpubs/SpecialPublications/
NIST.SP.800-56Ar2.pdf>. NIST.SP.800-56Ar2.pdf>.
Appendix A. Examples
A GitHub project has been created at <https://github.com/cose-wg/
Examples> that contains not only the examples presented in this
document, but a more complete set of testing examples as well. Each
example is found in a JSON file that contains the inputs used to
create the example, some of the intermediate values that can be used
in debugging the example and the output of the example presented in
both a hex and a CBOR diagnostic notation format. Some of the
examples at the site are designed failure testing cases; these are
clearly marked as such in the JSON file. If errors in the examples
in this document are found, the examples on GitHub will be updated,
and a note to that effect will be placed in the JSON file.
Acknowledgments Acknowledgments
This document is a product of the COSE working group of the IETF. This document is a product of the COSE working group of the IETF.
The following individuals are to blame for getting me started on this The following individuals are to blame for getting me started on this
project in the first place: Richard Barnes, Matt Miller, and Martin project in the first place: Richard Barnes, Matt Miller, and Martin
Thomson. Thomson.
The initial version of the specification was based to some degree on The initial version of the specification was based to some degree on
the outputs of the JOSE and S/MIME working groups. the outputs of the JOSE and S/MIME working groups.
 End of changes. 36 change blocks. 
210 lines changed or deleted 107 lines changed or added

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