draft-ietf-cose-hash-algs-01.txt   draft-ietf-cose-hash-algs-02.txt 
Network Working Group J. Schaad Network Working Group J. Schaad
Internet-Draft August Cellars Internet-Draft August Cellars
UpdatesRFC8152 (if approved) June 10, 2019 Intended status: Informational 4 November 2019
Intended status: Informational Expires: 7 May 2020
Expires: December 12, 2019
CBOR Object Signing and Encryption (COSE): Hash Algorithms CBOR Object Signing and Encryption (COSE): Hash Algorithms
draft-ietf-cose-hash-algs-01 draft-ietf-cose-hash-algs-02
Abstract Abstract
The CBOR Object Signing and Encryption (COSE) syntax RFC 8152 does The CBOR Object Signing and Encryption (COSE) syntax
not define any direct methods for using hash algorithms. There are [I-D.ietf-cose-rfc8152bis-struct] does not define any direct methods
however circumstances where hash algorithms are used: Indirect for using hash algorithms. There are however circumstances where
signatures, where the hash of one or more external contents are hash algorithms are used: Indirect signatures where the hash of one
signed, or thumbprints, for identification of X.509 certificates or or more contents are signed. X.509 certificate or other object
other objects. This document defines a set of hash algorithms that identification by the use of a thumbprint. This document defines a
are identified by COSE Algorithm Identifiers. set of hash algorithms that are identified by COSE Algorithm
Identifiers.
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/X509 Editorial changes can be managed in GitHub, but any cose-wg/X509 Editorial changes can be managed in GitHub, but any
substantial issues need to be discussed on the COSE mailing list. substantial 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 December 12, 2019. This Internet-Draft will expire on 7 May 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 (https://trustee.ietf.org/ Provisions Relating to IETF Documents (https://trustee.ietf.org/
license-info) in effect on the date of publication of this document. license-info) in effect on the date of publication of this document.
Please review these documents carefully, as they describe your rights Please review these documents carefully, as they describe your rights
skipping to change at page 2, line 42 skipping to change at page 2, line 47
1. Introduction 1. Introduction
The CBOR Object Signing and Encryption (COSE) syntax does not define The CBOR Object Signing and Encryption (COSE) syntax does not define
any direct methods for the use of hash algorithms. It also does not any direct methods for the use of hash algorithms. It also does not
define a structure syntax that is used to encode a digested object define a structure syntax that is used to encode a digested object
structure along the lines of the DigestedData ASN.1 structure in structure along the lines of the DigestedData ASN.1 structure in
[CMS]. This omission was intentional as a structure consisting of [CMS]. This omission was intentional as a structure consisting of
just a digest identifier, the content, and a digest value does not by just a digest identifier, the content, and a digest value does not by
itself provide any strong security service. Additionally, an itself provide any strong security service. Additionally, an
application is going to be better off defining this type of structure application is going to be better off defining this type of structure
so that it can include add any additional data that needs to be so that it can include any additional data that needs to be hashed,
hashed, as well as methods of obtaining the data. as well as methods of obtaining the data.
While the above is true, there are some cases where having some While the above is true, there are some cases where having some
standard hash algorithms defined for COSE with a common identifier standard hash algorithms defined for COSE with a common identifier
makes a great deal of sense. Two of the cases where these are going makes a great deal of sense. Two of the cases where these are going
to be used are: to be used are:
* Indirect signing of content, and * Indirect signing of content, and
* Object identification. * Object identification.
Indirect signing of content is a paradigm where the content is not Indirect signing of content is a paradigm where the content is not
directly signed, but instead a hash of the content is computed and directly signed, but instead a hash of the content is computed and
that hash value, along with the hash algorithm, is included in the that hash value, along with the hash algorithm, is included in the
content that will be signed. Doing indirect signing allows for the a content that will be signed. Doing indirect signing allows for a
signature to be validated without first downloading all of the signature to be validated without first downloading all of the
content associated with the signature. This capability can be of content associated with the signature. This capability can be of
even grater importance in a constrained environment as not all of the even greater importance in a constrained environment as not all of
content signed may be needed by the device. the content signed may be needed by the device.
The use of hashes to identify objects is something that has been very The use of hashes to identify objects is something that has been very
common. One of the primary things that has been identified by a hash common. One of the primary things that has been identified by a hash
function for secure message is a certificate. Two examples of this function for secure message is a certificate. Two examples of this
can be found in [ESS] and the newly defined COSE equivalents in can be found in [ESS] and the newly defined COSE equivalents in
[I-D.ietf-cose-x509]. [I-D.ietf-cose-x509].
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. Open Issues 1.2. Open Issues
RFC Editor: Please remove this section before publishing. This section is to be removed before publishing as an RFC.
* No Open Issues * No Open Issues
2. Hash Algorithm Usage 2. Hash Algorithm Usage
As noted in the previous section, hash functions can be used for a As noted in the previous section, hash functions can be used for a
variety of purposes. Some of these purposes require that a hash variety of purposes. Some of these purposes require that a hash
function be cryptographically strong, these include direct and function be cryptographically strong, these include direct and
indirect signatures. That is, using the hash as part of the indirect signatures. That is, using the hash as part of the
signature or using the hash as part of the body to be signed. Other signature or using the hash as part of the body to be signed. Other
uses of hash functions do not require the same level of strength. uses of hash functions do not require the same level of strength.
This document contains some hash functions that are not designed to This document contains some hash functions that are not designed to
be used for cryptographic operations. An application that is using a be used for cryptographic operations. An application that is using a
hash function needs to carefully evaluate exactly what hash hash function needs to carefully evaluate exactly what hash
properties are needed and which hash functions are going to provide properties are needed and which hash functions are going to provide
them. Applications should also make sure that the ability to change them. Applications should also make sure that the ability to change
hash functions is part of the base design as cryptographic advances hash functions is part of the base design as cryptographic advances
are sure to reduce strength of a hash function. are sure to reduce the strength of a hash function.
A hash function is a map from a large bit string to a smaller bit A hash function is a map from one, normally large, bit string to a
string. There are going to be collisions by a hash function, the second, usually smaller, bit string. There are going to be
trick is to make sure that it is difficult to find two values that collisions by a hash function, the trick is to make sure that it is
are going to map to the same output value. The standard "Collision difficult to find two values that are going to map to the same output
Attack" is one where an attacker can find two different messages that value. The standard "Collision Attack" is one where an attacker can
have the same hash value. If a collision attack exists, then the find two different messages that have the same hash value. If a
function SHOULD NOT be used for a cryptographic purpose. The only collision attack exists, then the function SHOULD NOT be used for a
reason why such a hash function is used is when there is absolutely cryptographic purpose. The only reason why such a hash function is
no other choice (e.g. a HSM that cannot be replaced), and only after used is when there is absolutely no other choice (e.g. a Hardware
Security Module (HSM) that cannot be replaced), and only after
looking at the possible security issues. Cryptographic purposes looking at the possible security issues. Cryptographic purposes
would include creation of signatures or the use of hashes for would include the creation of signatures or the use of hashes for
indirect signatures. These functions may still be usable for non- indirect signatures. These functions may still be usable for non-
cryptographic purposes. cryptographic purposes.
An example of a non-cryptographic use of a hash is for filtering from An example of a non-cryptographic use of a hash is for filtering from
a collection of values to find possible candidates that can later be a collection of values to find possible candidates that can later be
checked to see if they are the correct one. A simple example of this checked to see if they are the correct one. A simple example of this
is the classic thumbprint of a certificate. If the thumbprint is is the classic thumbprint of a certificate. If the thumbprint is
used to verify that it is the correct certificate, then that usage is used to verify that it is the correct certificate, then that usage is
subject to a collision attack as above. If however, the thumbprint subject to a collision attack as above. If however, the thumbprint
is used to sort through a collection of certificates to find those is used to sort through a collection of certificates to find those
skipping to change at page 5, line 9 skipping to change at page 5, line 16
* A pointer to the value that was hashed, this could be a pointer to * A pointer to the value that was hashed, this could be a pointer to
a file, an object that can be obtained from the network, or a a file, an object that can be obtained from the network, or a
pointer to someplace in the message, or something very application pointer to someplace in the message, or something very application
specific. specific.
* Additional data, this can be something as simple as a random value * Additional data, this can be something as simple as a random value
to make finding hash collisions slightly harder as the value to make finding hash collisions slightly harder as the value
handed to the application cannot have been selected to have a handed to the application cannot have been selected to have a
collision, or as complicated as a set of processing instructions collision, or as complicated as a set of processing instructions
that are to be used with the object that is pointed to. that are used with the object that is pointed to. The additional
data can be dealt with in a number of ways, prepending or
appending to the content, but it is strongly suggested to it
either be a fixed known size, or the lengths of the pieces being
hashed be included. (Encoding as a CBOR array accomplished this
requirement.)
An example of a structure which permits all of the above fields to An example of a structure which permits all of the above fields to
exist would look like the following. There is no definition here of exist would look like the following.
what goes into the 'any' value and how it would be included in the
computed hash value.
COSE_Hash_V = ( 1 : int / tstr, # Algorithm identifier 2 : bstr, # Hash value 3 : tstr ?, # Location of object hashed 4 : any ? # object containing other details and things - prefixed to the object to be hashed ) COSE_Hash_V = ( 1 : int / tstr, # Algorithm identifier 2 : bstr, # Hash value 3 : tstr ?, # Location of object hashed 4 : any ? # object containing other details and things )
An alternate structure that could be used for situations where one is An alternate structure that could be used for situations where one is
searching a group of objects for a match. In this case, the location searching a group of objects for a match. In this case, the location
would not be needed and adding extra data to the hash would be would not be needed and adding extra data to the hash would be
counterproductive. This results in a structure that looks like this: counterproductive. This results in a structure that looks like this:
COSE_Hash_Find = [ hashAlg : int / tstr, hashValue : bstr ] COSE_Hash_Find = [ hashAlg : int / tstr, hashValue : bstr ]
3. Hash Algorithm Identifiers 3. Hash Algorithm Identifiers
skipping to change at page 6, line 19 skipping to change at page 6, line 23
+-------+-------+-------------+-----------------+-------------+ +-------+-------+-------------+-----------------+-------------+
Table 1: SHA-1 Hash Algorithm Table 1: SHA-1 Hash Algorithm
3.2. SHA-2 Hash Algorithms 3.2. SHA-2 Hash Algorithms
The family of SHA-2 hash algorithms [FIPS-180-4] was designed by the The family of SHA-2 hash algorithms [FIPS-180-4] was designed by the
United States National Security Agency and published in 2001. Since United States National Security Agency and published in 2001. Since
that time some additional algorithms have been added to the original that time some additional algorithms have been added to the original
set to deal with length extension attacks and some performance set to deal with length extension attacks and some performance
issues. While the SHA-3 hash algorithms has been published since issues. While the SHA-3 hash algorithms have been published since
that time, the SHA-2 algorithms are still broadly used. that time, the SHA-2 algorithms are still broadly used.
There are a number of different parameters for the SHA-2 hash There are a number of different parameters for the SHA-2 hash
functions. The set of hash functions which have been chosen for functions. The set of hash functions which have been chosen for
inclusion in this document are based on those different parameters inclusion in this document are based on those different parameters
and some of the trade-offs involved. and some of the trade-offs involved.
* *SHA-256/64* provides a truncated hash. The length of the * *SHA-256/64* provides a truncated hash. The length of the
truncation is designed to allow for smaller transmission size. truncation is designed to allow for smaller transmission size.
The trade-off is that the odds that a collision will occur The trade-off is that the odds that a collision will occur
skipping to change at page 7, line 30 skipping to change at page 7, line 30
+-------------+-------+----------------+-----------+-------------+ +-------------+-------+----------------+-----------+-------------+
| SHA-512/256 | TBD5 | SHA-2 512-bit | [This | Yes | | SHA-512/256 | TBD5 | SHA-2 512-bit | [This | Yes |
| | | Hash truncated | Document] | | | | | Hash truncated | Document] | |
| | | to 256-bits | | | | | | to 256-bits | | |
+-------------+-------+----------------+-----------+-------------+ +-------------+-------+----------------+-----------+-------------+
Table 2: SHA-2 Hash Algorithms Table 2: SHA-2 Hash Algorithms
3.3. SHAKE Algorithms 3.3. SHAKE Algorithms
The family SHA-3 hash algorithms [FIPS-180-4] was the result of a The family SHA-3 hash algorithms [FIPS-202] was the result of a
competition run by NIST. The pair of algorithms known as SHAKE-128 competition run by NIST. The pair of algorithms known as SHAKE-128
and SHAKE-256 are the instances of SHA-3 that are currently being and SHAKE-256 are the instances of SHA-3 that are currently being
standardized in the IETF. standardized in the IETF.
The SHA-3 hash algorithms have a significantly different structure The SHA-3 hash algorithms have a significantly different structure
than the SHA-2 hash algorithms. One of the benefits of this than the SHA-2 hash algorithms. One of the benefits of this
differences is that when computing a shorter SHAKE hash value, the differences is that when computing a shorter SHAKE hash value, the
value is not a prefix of the result of computing the longer hash. value is not a prefix of the result of computing the longer hash.
Unlike the SHA-2 hash functions, no algorithm identifier is created Unlike the SHA-2 hash functions, no algorithm identifier is created
for shorter lengths. Applications can specify what the minimum for shorter lengths. Applications can specify a minimum length for
length for a hash function for the protocol. A validator can infer any hash function. A validator can infer the actual length from the
the actual length from the hash value in these cases. hash value in these cases.
+----------+-------+---------------+-----------------+-------------+ +----------+-------+---------------+-----------------+-------------+
| Name | Value | Description | Reference | Recommended | | Name | Value | Description | Reference | Recommended |
+==========+=======+===============+=================+=============+ +==========+=======+===============+=================+=============+
| SHAKE128 | TBD10 | 128-bit SHAKE | [This Document] | Yes | | SHAKE128 | TBD10 | 128-bit SHAKE | [This Document] | Yes |
+----------+-------+---------------+-----------------+-------------+ +----------+-------+---------------+-----------------+-------------+
| SHAKE256 | TBD11 | 256-bit SHAKE | [This Document] | Yes | | SHAKE256 | TBD11 | 256-bit SHAKE | [This Document] | Yes |
+----------+-------+---------------+-----------------+-------------+ +----------+-------+---------------+-----------------+-------------+
Table 3: SHAKE Hash Functions Table 3: SHAKE Hash Functions
skipping to change at page 9, line 16 skipping to change at page 9, line 16
hashed is a public value, as such pre-image resistance is not part hashed is a public value, as such pre-image resistance is not part
of this analysis. of this analysis.
* Algorithm agility needs to be considered a requirement for any use * Algorithm agility needs to be considered a requirement for any use
of hash functions. As with any cryptographic function, hash of hash functions. As with any cryptographic function, hash
functions are under constant attack and the strength of hash functions are under constant attack and the strength of hash
algorithms will be reduced over time. algorithms will be reduced over time.
6. Normative References 6. Normative References
[COSE] Schaad, J., "CBOR Object Signing and Encryption (COSE)",
RFC 8152, DOI 10.17487/RFC8152, July 2017,
<https://www.rfc-editor.org/info/rfc8152>.
[FIPS-180-4]
National Institute of Standards and Technology, "Secure
Hash Standard", FIPS PUB 180-4, August 2015.
[I-D.ietf-cose-rfc8152bis-struct]
Schaad, J., "CBOR CBOR Object Signing and Encryption
(COSE): Structures and Process", draft-ietf-cose-
rfc8152bis-struct-02 (work in progress), March 11, 2019,
<https://www.ietf.org/archive/id/draft-ietf-cose-
rfc8152bis-struct-02>.
[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>.
[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>.
[I-D.ietf-cose-rfc8152bis-struct]
Schaad, J., "CBOR Object Signing and Encryption (COSE):
Structures and Process", Work in Progress, Internet-Draft,
draft-ietf-cose-rfc8152bis-struct-06, 11 September 2019,
<https://tools.ietf.org/html/draft-ietf-cose-rfc8152bis-
struct-06>.
[FIPS-180-4]
National Institute of Standards and Technology, "Secure
Hash Standard", FIPS PUB 180-4, August 2015.
[FIPS-202] National Institute of Standards and Technology, "SHA-3
Standard: Permutation-Based Hash and Extendable-Output
Functions", FIPS PUB 202, August 2015.
[COSE] Schaad, J., "CBOR Object Signing and Encryption (COSE)",
RFC 8152, DOI 10.17487/RFC8152, July 2017,
<https://www.rfc-editor.org/info/rfc8152>.
7. Informative References 7. Informative References
[CMS] Housley, R., "Cryptographic Message Syntax (CMS)", STD 70, [CMS] Housley, R., "Cryptographic Message Syntax (CMS)", STD 70,
RFC 5652, DOI 10.17487/RFC5652, September 2009, RFC 5652, DOI 10.17487/RFC5652, September 2009,
<https://www.rfc-editor.org/info/rfc5652>. <https://www.rfc-editor.org/info/rfc5652>.
[ESS] Hoffman, P., Ed., "Enhanced Security Services for S/MIME", [ESS] Hoffman, P., Ed., "Enhanced Security Services for S/MIME",
RFC 2634, DOI 10.17487/RFC2634, June 1999, RFC 2634, DOI 10.17487/RFC2634, June 1999,
<https://www.rfc-editor.org/info/rfc2634>. <https://www.rfc-editor.org/info/rfc2634>.
skipping to change at page 10, line 4 skipping to change at page 10, line 9
[CMS] Housley, R., "Cryptographic Message Syntax (CMS)", STD 70, [CMS] Housley, R., "Cryptographic Message Syntax (CMS)", STD 70,
RFC 5652, DOI 10.17487/RFC5652, September 2009, RFC 5652, DOI 10.17487/RFC5652, September 2009,
<https://www.rfc-editor.org/info/rfc5652>. <https://www.rfc-editor.org/info/rfc5652>.
[ESS] Hoffman, P., Ed., "Enhanced Security Services for S/MIME", [ESS] Hoffman, P., Ed., "Enhanced Security Services for S/MIME",
RFC 2634, DOI 10.17487/RFC2634, June 1999, RFC 2634, DOI 10.17487/RFC2634, June 1999,
<https://www.rfc-editor.org/info/rfc2634>. <https://www.rfc-editor.org/info/rfc2634>.
[I-D.ietf-cose-x509] [I-D.ietf-cose-x509]
Schaad, J., "CBOR Object Signing and Encryption (COSE): Schaad, J., "CBOR Object Signing and Encryption (COSE):
Headers for carrying and referencing X.509 certificates", Headers for carrying and referencing X.509 certificates",
draft-ietf-cose-x509-01 (work in progress), March 11, Work in Progress, Internet-Draft, draft-ietf-cose-x509-04,
2019, 12 September 2019,
<https://www.ietf.org/archive/id/draft-ietf-cose-x509-01>. <https://tools.ietf.org/html/draft-ietf-cose-x509-04>.
[RFC3174] Eastlake 3rd, D. and P. Jones, "US Secure Hash Algorithm 1 [RFC3174] Eastlake 3rd, D. and P. Jones, "US Secure Hash Algorithm 1
(SHA1)", RFC 3174, DOI 10.17487/RFC3174, September 2001, (SHA1)", RFC 3174, DOI 10.17487/RFC3174, September 2001,
<https://www.rfc-editor.org/info/rfc3174>. <https://www.rfc-editor.org/info/rfc3174>.
[RFC6194] Polk, T., Chen, L., Turner, S., and P. Hoffman, "Security [RFC6194] Polk, T., Chen, L., Turner, S., and P. Hoffman, "Security
Considerations for the SHA-0 and SHA-1 Message-Digest Considerations for the SHA-0 and SHA-1 Message-Digest
Algorithms", RFC 6194, DOI 10.17487/RFC6194, March 2011, Algorithms", RFC 6194, DOI 10.17487/RFC6194, March 2011,
<https://www.rfc-editor.org/info/rfc6194>. <https://www.rfc-editor.org/info/rfc6194>.
 End of changes. 22 change blocks. 
58 lines changed or deleted 67 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/