draft-ietf-cose-hash-algs-08.txt   draft-ietf-cose-hash-algs-09.txt 
Network Working Group J. Schaad Network Working Group J. Schaad
Internet-Draft August Cellars Internet-Draft August Cellars
Intended status: Informational 29 July 2020 Intended status: Informational September 14, 2020
Expires: 30 January 2021 Expires: March 18, 2021
CBOR Object Signing and Encryption (COSE): Hash Algorithms CBOR Object Signing and Encryption (COSE): Hash Algorithms
draft-ietf-cose-hash-algs-08 draft-ietf-cose-hash-algs-09
Abstract Abstract
The CBOR Object Signing and Encryption (COSE) syntax The CBOR Object Signing and Encryption (COSE) syntax
[I-D.ietf-cose-rfc8152bis-struct] does not define any direct methods [I-D.ietf-cose-rfc8152bis-struct] does not define any direct methods
for using hash algorithms. There are, however, circumstances where for using hash algorithms. There are, however, circumstances where
hash algorithms are used, such as indirect signatures where the hash hash algorithms are used, such as indirect signatures where the hash
of one or more contents are signed, and X.509 certificate or other of one or more contents are signed, and X.509 certificate or other
object identification by the use of a fingerprint. This document object identification by the use of a fingerprint. This document
defines a set of hash algorithms that are identified by COSE defines a set of hash algorithms that are identified by COSE
skipping to change at page 1, line 46 skipping to change at page 1, line 46
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 30 January 2021. This Internet-Draft will expire on March 18, 2021.
Copyright Notice Copyright Notice
Copyright (c) 2020 IETF Trust and the persons identified as the Copyright (c) 2020 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 4, line 15 skipping to change at page 4, line 15
A hash function is a map from one, normally large, bit string to a A hash function is a map from one, normally large, bit string to a
second, usually smaller, bit string. As the number of possible input second, usually smaller, bit string. As the number of possible input
values is far greater than the number of possible output values, it values is far greater than the number of possible output values, it
is inevitable that there are going to be collisions. The trick is to is inevitable that there are going to be collisions. The trick is to
make sure that it is difficult to find two values that are going to make sure that it is difficult to find two values that are going to
map to the same output value. A "Collision Attack" is one where an map to the same output value. A "Collision Attack" is one where an
attacker can find two different messages that have the same hash attacker can find two different messages that have the same hash
value. A hash function that is susceptible to practical collision value. A hash function that is susceptible to practical collision
attacks, SHOULD NOT be used for a cryptographic purpose. The attacks, SHOULD NOT be used for a cryptographic purpose. The
discovery of theoretical collision attacks against a given hash discovery of theoretical collision attacks against a given hash
function SHOULD trigger a review of the continued suitability of the function SHOULD trigger protocol maintainers and users to do a review
algorithm if alternatives are available and migration is viable. The of the continued suitability of the algorithm if alternatives are
only reason why such a hash function is used is when there is available and migration is viable. The only reason why such a hash
absolutely no other choice (e.g. a Hardware Security Module (HSM) function is used is when there is absolutely no other choice (e.g. a
that cannot be replaced), and only after looking at the possible Hardware Security Module (HSM) that cannot be replaced), and only
security issues. Cryptographic purposes would include the creation after looking at the possible security issues. Cryptographic
of signatures or the use of hashes for indirect signatures. These purposes would include the creation of signatures or the use of
functions may still be usable for non-cryptographic purposes. hashes for indirect signatures. These functions may still be usable
for non-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 a set of possible candidates, the a collection of values to find a set of possible candidates; the
candidates can then be check to see if they can successfully be used. candidates can then be checked to see if they can successfully be
A simple example of this is the classic fingerprint of a certificate. used. A simple example of this is the classic fingerprint of a
If the fingerprint is used to verify that it is the correct certificate. If the fingerprint is used to verify that it is the
certificate, then that usage is a cryptographic one and is subject to correct certificate, then that usage is a cryptographic one and is
the warning above about collision attack. If, however, the subject to the warning above about collision attack. If, however,
fingerprint is used to sort through a collection of certificates to the fingerprint is used to sort through a collection of certificates
find those that might be used for the purpose of verifying a to find those that might be used for the purpose of verifying a
signature, a simple filter capability is sufficient. In this case, signature, a simple filter capability is sufficient. In this case,
one still needs to confirm that the public key validates the one still needs to confirm that the public key validates the
signature (and the certificate is trusted), and all certificates that signature (and the certificate is trusted), and all certificates that
don't contain a key that validates the signature can be discarded as don't contain a key that validates the signature can be discarded as
false positives. false positives.
To distinguish between these two cases, a new value in the To distinguish between these two cases, a new value in the
recommended column of the COSE Algorithms registry is to be added. recommended column of the COSE Algorithms registry is to be added.
"Filter Only" indicates that the only purpose of a hash function "Filter Only" indicates that the only purpose of a hash function
should be to filter results and it is not intended for applications should be to filter results and it is not intended for applications
skipping to change at page 6, line 16 skipping to change at page 6, line 16
The SHA-1 hash algorithm [RFC3174] was designed by the United States The SHA-1 hash algorithm [RFC3174] was designed by the United States
National Security Agency and published in 1995. Since that time a National Security Agency and published in 1995. Since that time a
large amount of cryptographic analysis has been applied to this large amount of cryptographic analysis has been applied to this
algorithm and a successful collision attack has been created algorithm and a successful collision attack has been created
([SHA-1-collision]). The IETF formally started discouraging the use ([SHA-1-collision]). The IETF formally started discouraging the use
of SHA-1 with the publishing of [RFC6194]. of SHA-1 with the publishing of [RFC6194].
Despite the above, there are still times where SHA-1 needs to be used Despite the above, there are still times where SHA-1 needs to be used
and therefore it makes sense to assign a codepoint for the use of and therefore it makes sense to assign a codepoint for the use of
this hash algorithm. Some of these situations are with historic HSMs this hash algorithm. Some of these situations are with historic HSMs
where only SHA-1 is implemented, other situations are where the SHA-1 where only SHA-1 is implemented; other situations are where the SHA-1
value is used for the purpose of filtering and thus the collision value is used for the purpose of filtering and thus the collision
resistance property is not needed. resistance property is not needed.
Because of the known issues for SHA-1 and the fact that it should no Because of the known issues for SHA-1 and the fact that it should no
longer be used, the algorithm will be registered with the longer be used, the algorithm will be registered with the
recommendation of "Filter Only". This provides guidance about when recommendation of "Filter Only". This provides guidance about when
the algorithm is safe for use, while discouraging usage where it is the algorithm is safe for use, while discouraging usage where it is
not safe. not safe.
The COSE capabilities for these algorithms is an empty array. The COSE capabilities for this algorithm is an empty array.
+=====+======+=============+==============+===========+=============+ +=====+======+=============+==============+===========+=============+
|Name |Value | Description | Capabilities | Reference | Recommended | |Name |Value | Description | Capabilities | Reference | Recommended |
+=====+======+=============+==============+===========+=============+ +=====+======+=============+==============+===========+=============+
|SHA-1| TBD6 | SHA-1 Hash | [] | [This | Filter Only | |SHA-1| -14 | SHA-1 Hash | [] | [This | Filter Only |
| | | | | Document] | | | | | | | Document] | |
+-----+------+-------------+--------------+-----------+-------------+ +-----+------+-------------+--------------+-----------+-------------+
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
skipping to change at page 7, line 8 skipping to change at page 7, line 8
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
increase proportionally. Use of this hash function needs analyze increase proportionally. Use of this hash function needs analysis
of the potential problems with having a collision occur, or must of the potential problems with having a collision occur, or must
be limited to where the function of the hash is non-cryptographic. be limited to where the function of the hash is non-cryptographic.
The latter is the case for [I-D.ietf-cose-x509]. The hash value The latter is the case for [I-D.ietf-cose-x509]. The hash value
is used to select possible certificates and, if there are multiple is used to select possible certificates and, if there are multiple
choices remaining then, each choice can be tested by using the choices remaining then, each choice can be tested by using the
public key. public key.
* *SHA-256* is probably the most common hash function used * *SHA-256* is probably the most common hash function used
currently. SHA-256 is an efficient hash algorithm for 32-bit currently. SHA-256 is an efficient hash algorithm for 32-bit
skipping to change at page 8, line 8 skipping to change at page 8, line 8
* *SHA-512/256* provides a hash function that runs more efficiently * *SHA-512/256* provides a hash function that runs more efficiently
on 64-bit hardware, but offers the same security levels as SHA- on 64-bit hardware, but offers the same security levels as SHA-
256. 256.
The COSE capabilities array for these algorithms is empty. The COSE capabilities array for these algorithms is empty.
+===========+=====+===========+==============+=========+============+ +===========+=====+===========+==============+=========+============+
| Name |Value|Description| Capabilities |Reference|Recommended | | Name |Value|Description| Capabilities |Reference|Recommended |
+===========+=====+===========+==============+=========+============+ +===========+=====+===========+==============+=========+============+
|SHA-256/64 |TBD1 | SHA-2 | [] | [This |Filter Only | |SHA-256/64 | -15 | SHA-2 | [] | [This |Filter Only |
| | | 256-bit | |Document]| | | | | 256-bit | |Document]| |
| | | Hash | | | | | | | Hash | | | |
| | | truncated | | | | | | | truncated | | | |
| | |to 64-bits | | | | | | |to 64-bits | | | |
+-----------+-----+-----------+--------------+---------+------------+ +-----------+-----+-----------+--------------+---------+------------+
| SHA-256 |TBD2 | SHA-2 | [] | [This | Yes | | SHA-256 | -16 | SHA-2 | [] | [This | Yes |
| | | 256-bit | |Document]| | | | | 256-bit | |Document]| |
| | | Hash | | | | | | | Hash | | | |
+-----------+-----+-----------+--------------+---------+------------+ +-----------+-----+-----------+--------------+---------+------------+
| SHA-384 |TBD3 | SHA-2 | [] | [This | Yes | | SHA-384 | -43 | SHA-2 | [] | [This | Yes |
| | | 384-bit | |Document]| | | | | 384-bit | |Document]| |
| | | Hash | | | | | | | Hash | | | |
+-----------+-----+-----------+--------------+---------+------------+ +-----------+-----+-----------+--------------+---------+------------+
| SHA-512 |TBD4 | SHA-2 | [] | [This | Yes | | SHA-512 | -44 | SHA-2 | [] | [This | Yes |
| | | 512-bit | |Document]| | | | | 512-bit | |Document]| |
| | | Hash | | | | | | | Hash | | | |
+-----------+-----+-----------+--------------+---------+------------+ +-----------+-----+-----------+--------------+---------+------------+
|SHA-512/256|TBD5 | SHA-2 | [] | [This | Yes | |SHA-512/256| -17 | SHA-2 | [] | [This | Yes |
| | | 512-bit | |Document]| | | | | 512-bit | |Document]| |
| | | Hash | | | | | | | Hash | | | |
| | | truncated | | | | | | | truncated | | | |
| | |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 of SHA-3 hash algorithms [FIPS-202] was the result of a The family of 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. This is the reason for including these standardized in the IETF. This is the reason for including these
algorithms in this document. algorithms in this document.
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.
difference is that when computing a shorter SHAKE hash value, the
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. The length of the hash value stored is 256-bits for shorter lengths. The length of the hash value stored is 256-bits
for SHAKE-128 and 512-bits for SHAKE-256. for SHAKE-128 and 512-bits for SHAKE-256.
The COSE capabilities array for these algorithms is empty. The COSE capabilities array for these algorithms is empty.
+========+=====+=============+==============+=========+=============+ +========+=====+=============+==============+=========+=============+
| Name |Value| Description | Capabilities |Reference| Recommended | | Name |Value| Description | Capabilities |Reference| Recommended |
+========+=====+=============+==============+=========+=============+ +========+=====+=============+==============+=========+=============+
|SHAKE128|TBD10| SHAKE-128 | [] | [This | Yes | |SHAKE128| -18 | SHAKE-128 | [] | [This | Yes |
| | |256-bit Hash | |Document]| | | | |256-bit Hash | |Document]| |
| | | Value | | | | | | | Value | | | |
+--------+-----+-------------+--------------+---------+-------------+ +--------+-----+-------------+--------------+---------+-------------+
|SHAKE256|TBD11| SHAKE-256 | [] | [This | Yes | |SHAKE256| -45 | SHAKE-256 | [] | [This | Yes |
| | |512-bit Hash | |Document]| | | | |512-bit Hash | |Document]| |
| | | Value | | | | | | | Value | | | |
+--------+-----+-------------+--------------+---------+-------------+ +--------+-----+-------------+--------------+---------+-------------+
Table 3: SHAKE Hash Functions Table 3: SHAKE Hash Functions
4. IANA Considerations 4. IANA Considerations
The IANA actions in [I-D.ietf-cose-rfc8152bis-struct] and The IANA actions in [I-D.ietf-cose-rfc8152bis-struct] and
[I-D.ietf-cose-rfc8152bis-algs] need to be executed before the [I-D.ietf-cose-rfc8152bis-algs] need to be executed before the
skipping to change at page 9, line 39 skipping to change at page 9, line 39
Algorithms" registry. Algorithms" registry.
* The SHA-1 hash function found in Table 1. * The SHA-1 hash function found in Table 1.
* The set of SHA-2 hash functions found in Table 2. * The set of SHA-2 hash functions found in Table 2.
* The set of SHAKE hash functions found in Table 3. * The set of SHAKE hash functions found in Table 3.
Many of the hash values produced are relatively long and as such the Many of the hash values produced are relatively long and as such the
use of a two byte algorithm identifier seems reasonable. SHA-1 is use of a two byte algorithm identifier seems reasonable. SHA-1 is
tagged as deprecated and thus a longer algorithm identifier is tagged as 'Filter Only' and thus a longer algorithm identifier is
appropriate even though it is a shorter hash value. appropriate even though it is a shorter hash value.
In addition, IANA is to add the value of 'Filter Only' to the set of IANA is requested to add the value of 'Filter Only' to the set of
legal values for the 'Recommended' column. This value is only to be legal values for the 'Recommended' column. This value is only to be
used for hash functions and indicates that it is not to be used for used for hash functions and indicates that it is not to be used for
purposes which require collision resistance. IANA is requested to purposes which require collision resistance. IANA is requested to
add this document to the reference section for this table due to this add this document to the reference section for this table due to this
addition. addition.
5. Security Considerations 5. Security Considerations
Protocols need to perform a careful analysis of the properties of a Protocols need to perform a careful analysis of the properties of a
hash function that are needed and how they map onto the possible hash function that are needed and how they map onto the possible
skipping to change at page 10, line 40 skipping to change at page 10, line 40
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] [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", Work in Progress, Internet-Draft, Structures and Process", Work in Progress, Internet-Draft,
draft-ietf-cose-rfc8152bis-struct-11, 1 July 2020, draft-ietf-cose-rfc8152bis-struct-12, August 24, 2020,
<https://tools.ietf.org/html/draft-ietf-cose-rfc8152bis- <https://tools.ietf.org/html/draft-ietf-cose-rfc8152bis-
struct-11>. struct-12>.
[FIPS-180-4] [FIPS-180-4]
National Institute of Standards and Technology, "Secure National Institute of Standards and Technology, "Secure
Hash Standard", FIPS PUB 180-4, August 2015. Hash Standard", FIPS PUB 180-4, August 2015.
[FIPS-202] National Institute of Standards and Technology, "SHA-3 [FIPS-202] National Institute of Standards and Technology, "SHA-3
Standard: Permutation-Based Hash and Extendable-Output Standard: Permutation-Based Hash and Extendable-Output
Functions", FIPS PUB 202, August 2015. Functions", FIPS PUB 202, August 2015.
[RFC3174] Eastlake 3rd, D. and P. Jones, "US Secure Hash Algorithm 1 [RFC3174] Eastlake 3rd, D. and P. Jones, "US Secure Hash Algorithm 1
skipping to change at page 11, line 23 skipping to change at page 11, line 23
<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):
Header parameters for carrying and referencing X.509 Header parameters for carrying and referencing X.509
certificates", Work in Progress, Internet-Draft, draft- certificates", Work in Progress, Internet-Draft, draft-
ietf-cose-x509-06, 9 March 2020, ietf-cose-x509-06, March 9, 2020,
<https://tools.ietf.org/html/draft-ietf-cose-x509-06>. <https://tools.ietf.org/html/draft-ietf-cose-x509-06>.
[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>.
[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", Work in Progress, Internet-Draft, Initial Algorithms", Work in Progress, Internet-Draft,
draft-ietf-cose-rfc8152bis-algs-11, 1 July 2020, draft-ietf-cose-rfc8152bis-algs-11, July 1, 2020,
<https://tools.ietf.org/html/draft-ietf-cose-rfc8152bis- <https://tools.ietf.org/html/draft-ietf-cose-rfc8152bis-
algs-11>. algs-11>.
[I-D.ietf-suit-manifest] [I-D.ietf-suit-manifest]
Moran, B., Tschofenig, H., Birkholz, H., and K. Zandberg, Moran, B., Tschofenig, H., Birkholz, H., and K. Zandberg,
"A Concise Binary Object Representation (CBOR)-based "A Concise Binary Object Representation (CBOR)-based
Serialization Format for the Software Updates for Internet Serialization Format for the Software Updates for Internet
of Things (SUIT) Manifest", Work in Progress, Internet- of Things (SUIT) Manifest", Work in Progress, Internet-
Draft, draft-ietf-suit-manifest-09, 13 July 2020, Draft, draft-ietf-suit-manifest-09, July 13, 2020,
<https://tools.ietf.org/html/draft-ietf-suit-manifest-09>. <https://tools.ietf.org/html/draft-ietf-suit-manifest-09>.
[BCP201] Housley, R., "Guidelines for Cryptographic Algorithm [BCP201] Housley, R., "Guidelines for Cryptographic Algorithm
Agility and Selecting Mandatory-to-Implement Algorithms", Agility and Selecting Mandatory-to-Implement Algorithms",
BCP 201, RFC 7696, November 2015. BCP 201, RFC 7696, November 2015.
<https://www.rfc-editor.org/info/bcp201> <https://www.rfc-editor.org/info/bcp201>
[SHA-1-collision] [SHA-1-collision]
Stevens, M., Bursztein, E., Karpman, P., Albertini, A., Stevens, M., Bursztein, E., Karpman, P., Albertini, A.,
 End of changes. 24 change blocks. 
41 lines changed or deleted 40 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/