--- 1/draft-ietf-cose-hash-algs-02.txt 2020-03-09 16:19:17.844842663 -0700 +++ 2/draft-ietf-cose-hash-algs-03.txt 2020-03-09 16:19:17.904844181 -0700 @@ -1,27 +1,27 @@ Network Working Group J. Schaad Internet-Draft August Cellars -Intended status: Informational 4 November 2019 -Expires: 7 May 2020 +Intended status: Informational 9 March 2020 +Expires: 10 September 2020 CBOR Object Signing and Encryption (COSE): Hash Algorithms - draft-ietf-cose-hash-algs-02 + draft-ietf-cose-hash-algs-03 Abstract The CBOR Object Signing and Encryption (COSE) syntax [I-D.ietf-cose-rfc8152bis-struct] does not define any direct methods for using hash algorithms. There are however circumstances where hash algorithms are used: Indirect signatures where the hash of one or more contents are signed. X.509 certificate or other object - identification by the use of a thumbprint. This document defines a + identification by the use of a fingerprint. This document defines a set of hash algorithms that are identified by COSE Algorithm Identifiers. 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 changes should be submitted as pull requests at https://github.com/ cose-wg/X509 Editorial changes can be managed in GitHub, but any @@ -35,52 +35,51 @@ Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at https://datatracker.ietf.org/drafts/current/. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." - This Internet-Draft will expire on 7 May 2020. + This Internet-Draft will expire on 10 September 2020. Copyright Notice - Copyright (c) 2019 IETF Trust and the persons identified as the + Copyright (c) 2020 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/ license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License. Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1. Requirements Terminology . . . . . . . . . . . . . . . . 3 - 1.2. Open Issues . . . . . . . . . . . . . . . . . . . . . . . 3 2. Hash Algorithm Usage . . . . . . . . . . . . . . . . . . . . 3 2.1. Example CBOR hash structure . . . . . . . . . . . . . . . 4 3. Hash Algorithm Identifiers . . . . . . . . . . . . . . . . . 5 3.1. SHA-1 Hash Algorithm . . . . . . . . . . . . . . . . . . 5 3.2. SHA-2 Hash Algorithms . . . . . . . . . . . . . . . . . . 6 3.3. SHAKE Algorithms . . . . . . . . . . . . . . . . . . . . 7 4. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 8 4.1. COSE Algorithm Registry . . . . . . . . . . . . . . . . . 8 5. Security Considerations . . . . . . . . . . . . . . . . . . . 8 6. Normative References . . . . . . . . . . . . . . . . . . . . 9 - 7. Informative References . . . . . . . . . . . . . . . . . . . 9 + 7. Informative References . . . . . . . . . . . . . . . . . . . 10 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 10 1. Introduction The CBOR Object Signing and Encryption (COSE) syntax does not define 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 structure along the lines of the DigestedData ASN.1 structure in [CMS]. This omission was intentional as a structure consisting of just a digest identifier, the content, and a digest value does not by @@ -114,26 +113,20 @@ [I-D.ietf-cose-x509]. 1.1. Requirements Terminology The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here. -1.2. Open Issues - - This section is to be removed before publishing as an RFC. - - * No Open Issues - 2. Hash Algorithm Usage As noted in the previous section, hash functions can be used for a variety of purposes. Some of these purposes require that a hash function be cryptographically strong, these include direct and 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 uses of hash functions do not require the same level of strength. This document contains some hash functions that are not designed to @@ -155,23 +148,23 @@ 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 would include the creation of signatures or the use of 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 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 - is the classic thumbprint of a certificate. If the thumbprint is + is the classic fingerprint of a certificate. If the fingerprint 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 fingerprint is used to sort through a collection of certificates to find those that might be used for the purpose of verifying a signature, a simple filter capability is sufficient. In this case, one still needs to validate that the public key validates the signature (and the certificate is trusted), and all certificates that don't contain a key that validates the signature can be discarded as false positives. To distinguish between these two cases, a new value in the recommended column of the COSE Algorithms registry is to be added. "Filter Only" indicates that the only purpose of a hash function @@ -189,41 +182,49 @@ * The hash algorithm identifier. * The hash value. * 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 pointer to someplace in the message, or something very application specific. * 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 - collision, or as complicated as a set of processing instructions + collision), or as complicated as a set of processing instructions 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 exist would look like the following. - 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 ) + 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 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 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.1. SHA-1 Hash Algorithm The SHA-1 hash algorithm [RFC3174] was designed by the United States National Security Agency and published in 1995. Since that time a large amount of cryptographic analysis has been applied to this algorithm and a successful collision attack has been created ([SHA-1-collision]). The IETF formally started discouraging the use @@ -233,25 +234,28 @@ and therefore it makes sense to assign a point for the use of this hash algorithm. Some of these situations are with historic HSMs where only SHA-1 is implemented or where the SHA-1 value is used for the purpose of filtering and thus the collision resistance property is not needed. Because of the known issues for SHA-1 and the fact that is should no longer be used, the algorithm will be registered with the recommendation of "Filter Only". - +-------+-------+-------------+-----------------+-------------+ - | Name | Value | Description | Reference | Recommended | - +=======+=======+=============+=================+=============+ - | SHA-1 | TBD6 | SHA-1 Hash | [This Document] | Filter Only | - +-------+-------+-------------+-----------------+-------------+ + The COSE capabilities for this algorithm is an empty array. + + +-----+------+-------------+--------------+-----------+-------------+ + |Name |Value | Description | Capabilities | Reference | Recommended | + +=====+======+=============+==============+===========+=============+ + |SHA-1| TBD6 | SHA-1 Hash | [] | [This | Filter Only | + | | | | | Document] | | + +-----+------+-------------+--------------+-----------+-------------+ Table 1: SHA-1 Hash Algorithm 3.2. SHA-2 Hash Algorithms The family of SHA-2 hash algorithms [FIPS-180-4] was designed by the United States National Security Agency and published in 2001. Since that time some additional algorithms have been added to the original set to deal with length extension attacks and some performance issues. While the SHA-3 hash algorithms have been published since @@ -278,67 +282,80 @@ currently. SHA-256 is an efficient hash algorithm for 32-bit hardware. * *SHA-384* and *SHA-512* hash functions are efficient for 64-bit hardware. * *SHA-512/256* provides a hash function that runs more efficiently on 64-bit hardware, but offers the same security levels as SHA- 256. - +-------------+-------+----------------+-----------+-------------+ - | Name | Value | Description | Reference | Recommended | - +=============+=======+================+===========+=============+ - | SHA-256/64 | TBD1 | SHA-2 256-bit | [This | Filter Only | - | | | Hash truncated | Document] | | - | | | to 64-bits | | | - +-------------+-------+----------------+-----------+-------------+ - | SHA-256 | TBD2 | SHA-2 256-bit | [This | Yes | - | | | Hash | Document] | | - +-------------+-------+----------------+-----------+-------------+ - | SHA-384 | TBD3 | SHA-2 384-bit | [This | Yes | - | | | Hash | Document] | | - +-------------+-------+----------------+-----------+-------------+ - | SHA-512 | TBD4 | SHA-2 512-bit | [This | Yes | - | | | Hash | Document] | | - +-------------+-------+----------------+-----------+-------------+ - | SHA-512/256 | TBD5 | SHA-2 512-bit | [This | Yes | - | | | Hash truncated | Document] | | - | | | to 256-bits | | | - +-------------+-------+----------------+-----------+-------------+ + The COSE capabilities for these algorithms is an empty array. + + +-----------+-----+-----------+--------------+---------+------------+ + | Name |Value|Description| Capabilities |Reference|Recommended | + +===========+=====+===========+==============+=========+============+ + |SHA-256/64 |TBD1 | SHA-2 | [] | [This |Filter Only | + | | | 256-bit | |Document]| | + | | | Hash | | | | + | | | truncated | | | | + | | |to 64-bits | | | | + +-----------+-----+-----------+--------------+---------+------------+ + | SHA-256 |TBD2 | SHA-2 | [] | [This | Yes | + | | | 256-bit | |Document]| | + | | | Hash | | | | + +-----------+-----+-----------+--------------+---------+------------+ + | SHA-384 |TBD3 | SHA-2 | [] | [This | Yes | + | | | 384-bit | |Document]| | + | | | Hash | | | | + +-----------+-----+-----------+--------------+---------+------------+ + | SHA-512 |TBD4 | SHA-2 | [] | [This | Yes | + | | | 512-bit | |Document]| | + | | | Hash | | | | + +-----------+-----+-----------+--------------+---------+------------+ + |SHA-512/256|TBD5 | SHA-2 | [] | [This | Yes | + | | | 512-bit | |Document]| | + | | | Hash | | | | + | | | truncated | | | | + | | |to 256-bits| | | | + +-----------+-----+-----------+--------------+---------+------------+ Table 2: SHA-2 Hash Algorithms 3.3. SHAKE Algorithms 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 and SHAKE-256 are the instances of SHA-3 that are currently being standardized in the IETF. The SHA-3 hash algorithms have a significantly different structure than the SHA-2 hash algorithms. One of the benefits of this differences 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 for shorter lengths. Applications can specify a minimum length for any hash function. A validator can infer the actual length from the hash value in these cases. - +----------+-------+---------------+-----------------+-------------+ - | Name | Value | Description | Reference | Recommended | - +==========+=======+===============+=================+=============+ - | SHAKE128 | TBD10 | 128-bit SHAKE | [This Document] | Yes | - +----------+-------+---------------+-----------------+-------------+ - | SHAKE256 | TBD11 | 256-bit SHAKE | [This Document] | Yes | - +----------+-------+---------------+-----------------+-------------+ + The COSE capabilities for these algorithms is an empty array. + + +--------+-----+-------------+--------------+---------+-------------+ + | Name |Value| Description | Capabilities |Reference| Recommended | + +========+=====+=============+==============+=========+=============+ + |SHAKE128|TBD10|128-bit SHAKE| [] | [This | Yes | + | | | | |Document]| | + +--------+-----+-------------+--------------+---------+-------------+ + |SHAKE256|TBD11|256-bit SHAKE| [] | [This | Yes | + | | | | |Document]| | + +--------+-----+-------------+--------------+---------+-------------+ Table 3: SHAKE Hash Functions 4. IANA Considerations 4.1. COSE Algorithm Registry IANA is requested to register the following algorithms in the "COSE Algorithms" registry. @@ -390,23 +407,23 @@ DOI 10.17487/RFC2119, March 1997, . [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017, . [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, + draft-ietf-cose-rfc8152bis-struct-07, 17 November 2019, . + struct-07>. [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)", @@ -419,23 +436,23 @@ RFC 5652, DOI 10.17487/RFC5652, September 2009, . [ESS] Hoffman, P., Ed., "Enhanced Security Services for S/MIME", RFC 2634, DOI 10.17487/RFC2634, June 1999, . [I-D.ietf-cose-x509] Schaad, J., "CBOR Object Signing and Encryption (COSE): Headers for carrying and referencing X.509 certificates", - Work in Progress, Internet-Draft, draft-ietf-cose-x509-04, - 12 September 2019, - . + Work in Progress, Internet-Draft, draft-ietf-cose-x509-05, + 4 November 2019, + . [RFC3174] Eastlake 3rd, D. and P. Jones, "US Secure Hash Algorithm 1 (SHA1)", RFC 3174, DOI 10.17487/RFC3174, September 2001, . [RFC6194] Polk, T., Chen, L., Turner, S., and P. Hoffman, "Security Considerations for the SHA-0 and SHA-1 Message-Digest Algorithms", RFC 6194, DOI 10.17487/RFC6194, March 2011, .