idnits 2.17.1 draft-ietf-curdle-cms-eddsa-signatures-05.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (11 April 2017) is 2565 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: 'RFC5652' is mentioned on line 205, but not defined == Outdated reference: A later version (-10) exists of draft-ietf-curdle-pkix-02 ** Downref: Normative reference to an Informational RFC: RFC 8032 (ref. 'EDDSA') -- Possible downref: Non-RFC (?) normative reference: ref. 'FIPS180' -- Possible downref: Non-RFC (?) normative reference: ref. 'FIPS202' -- Possible downref: Non-RFC (?) normative reference: ref. 'X680' -- Possible downref: Non-RFC (?) normative reference: ref. 'X690' Summary: 1 error (**), 0 flaws (~~), 3 warnings (==), 5 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Internet-Draft R. Housley 3 Intended status: Standards Track Vigil Security 4 Expires: 11 October 2017 11 April 2017 6 Use of EdDSA Signatures in the Cryptographic Message Syntax (CMS) 7 9 Abstract 11 This document specifies the conventions for using Edwards-curve 12 Digital Signature Algorithm (EdDSA) for Curve25519 and Curve448 in 13 the Cryptographic Message Syntax (CMS). For each curve, EdDSA 14 defines the PureEdDSA and HashEdDSA modes. However, the HashEdDSA 15 mode is not used with the CMS. In addition, no context string is 16 used with the CMS. 18 Status of This Memo 20 This Internet-Draft is submitted in full conformance with the 21 provisions of BCP 78 and BCP 79. 23 Internet-Drafts are working documents of the Internet Engineering 24 Task Force (IETF). Note that other groups may also distribute 25 working documents as Internet-Drafts. The list of current Internet- 26 Drafts is at http://datatracker.ietf.org/drafts/current/. 28 Internet-Drafts are draft documents valid for a maximum of six months 29 and may be updated, replaced, or obsoleted by other documents at any 30 time. It is inappropriate to use Internet-Drafts as reference 31 material or to cite them other than as "work in progress." 33 This Internet-Draft will expire on 11 October 2017. 35 Copyright Notice 37 Copyright (c) 2017 IETF Trust and the persons identified as the 38 document authors. All rights reserved. 40 This document is subject to BCP 78 and the IETF Trust's Legal 41 Provisions Relating to IETF Documents 42 (http://trustee.ietf.org/license-info) in effect on the date of 43 publication of this document. Please review these documents 44 carefully, as they describe your rights and restrictions with respect 45 to this document. Code Components extracted from this document must 46 include Simplified BSD License text as described in Section 4.e of 47 the Trust Legal Provisions and are provided without warranty as 48 described in the Simplified BSD License. 50 1. Introduction 52 This document specifies the conventions for using the Edwards-curve 53 Digital Signature Algorithm (EdDSA) [EDDSA] for Curve25519 and 54 Curve448 with the Cryptographic Message Syntax [CMS] signed-data 55 content type. For each curve, [EDDSA] defines the PureEdDSA and 56 HashEdDSA modes. However, the HashEdDSA mode is not used with the 57 CMS. In addition, no context string is used with CMS. EdDSA with 58 Curve25519 is referred to as Ed25519, and EdDSA with Curve448 is 59 referred to as Ed448. The CMS conventions for PureEdDSA with Ed25519 60 and Ed448 are described in this document. 62 1.1. Terminology 64 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 65 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 66 document are to be interpreted as described in RFC 2119 [STDWORDS]. 68 1.2. ASN.1 70 CMS values are generated using ASN.1 [X680], which uses the Basic 71 Encoding Rules (BER) and the Distinguished Encoding Rules (DER) 72 [X690]. 74 2. EdDSA Signature Algorithm 76 The Edwards-curve Digital Signature Algorithm (EdDSA) [EDDSA] is a 77 variant of Schnorr's signature system with (possibly twisted) Edwards 78 curves. Ed25519 is intended to operate at around the 128-bit 79 security level, and Ed448 at around the 224-bit security level. 81 One of the parameters of the EdDSA algorithm is the "prehash" 82 function. This may be the identity function, resulting in an 83 algorithm called PureEdDSA, or a collision-resistant hash function, 84 resulting in an algorithm called HashEdDSA. In most situations the 85 CMS SignedData includes signed attributes, including the message 86 digest of the content. Since HashEdDSA offers no benefit when signed 87 attributes are present, only PureEdDSA is used with the CMS. 89 2.1. Algorithm Identifiers 91 Each algorithms are identified by an object identifier, and the 92 algorithm identifier may contain parameters if needed. 94 The ALGORITHM definition is repeated here for convenience: 96 ALGORITHM ::= CLASS { 97 &id OBJECT IDENTIFIER UNIQUE, 98 &Type OPTIONAL } 99 WITH SYNTAX { 100 OID &id [PARMS &Type] } 102 2.2. EdDSA Algorithm Identifiers 104 The EdDSA signature algorithm is defined in [EDDSA], and the 105 conventions for encoding the public key are defined in 106 [CURDLE-PKIX]. 108 The id-Ed25519 and id-Ed448 object identifiers are used to identify 109 EdDSA public keys in certificates. The object identifiers are 110 specified in [CURDLE-PKIX], and they are repeated here for 111 convenience: 113 sigAlg-Ed25519 ALGORITHM ::= { OID id-Ed25519 } 115 sigAlg-Ed448 ALGORITHM ::= { OID id-Ed448 } 117 id-Ed25519 OBJECT IDENTIFIER ::= { 1 3 101 112 } 119 id-Ed448 OBJECT IDENTIFIER ::= { 1 3 101 113 } 121 2.3. Message Digest Algorithm Identifiers 123 When the signer includes signed attributes, a message digest 124 algorithm is used to compute the message digest on the eContent 125 value. When signing with Ed25519, the message digest algorithm MUST 126 be SHA-512 [FIPS180]. Additional information on SHA-512 is available 127 in RFC 6234 [RFC6234]. When signing with Ed448, the message digest 128 algorithm MUST be SHAKE256 [FIPS202] with a 512-bit output value. 130 Signing with Ed25519 uses SHA-512 as part of the signing operation, 131 and signing with Ed448 uses SHAKE256 as part of the signing 132 operation. 134 For convenience, the object identifiers and parameter syntax for 135 these algorithms are repeated here: 137 hashAlg-SHA-512 ALGORITHM ::= { OID id-sha512 } 139 hashAlg-SHAKE256 ALGORITHM ::= { OID id-shake256 } 140 hashAlg-SHAKE256-LEN ALGORITHM ::= { OID id-shake256-len 141 PARMS ShakeOutputLen } 143 hashalgs OBJECT IDENTIFIER ::= { joint-iso-itu-t(2) 144 country(16) us(840) organization(1) 145 gov(101) csor(3) nistalgorithm(4) 2 } 147 id-sha512 OBJECT IDENTIFIER ::= { hashAlgs 3 } 149 id-shake256 OBJECT IDENTIFIER ::= { hashAlgs 12 } 151 id-shake256-len OBJECT IDENTIFIER ::= { hashAlgs 18 } 153 ShakeOutputLen ::= INTEGER -- Output length in bits 155 When using the id-sha512 or id-shake256 algorithm identifier, the 156 parameters MUST be absent. 158 When using the id-shake256-len algorithm identifier, the parameters 159 MUST be present, and the parameter MUST contain 512, encoded as a 160 positive integer value. 162 2.4. EdDSA Signatures 164 The id-Ed25519 and id-Ed448 object identifiers are also used for 165 signature values. When used to identify signature algorithms, the 166 AlgorithmIdentifier parameters field MUST be absent. 168 The data to be signed is processed using PureEdDSA, and then a 169 private key operation generates the signature value. As described in 170 Section 3.3 of [EDDSA], the signature value is the opaque value 171 ENC(R) || ENC(S). As described in Section 5.3 of [CMS], the 172 signature value is ASN.1 encoded as an OCTET STRING and included in 173 the signature field of SignerInfo. 175 3. Signed-data Conventions 177 The processing depends on whether the signer includes signed 178 attributes. 180 The inclusion of signed attributes is preferred, but the conventions 181 for signed-data without signed attributes are provided for 182 completeness. 184 3.1. Signed-data Conventions With Signed Attributes 186 The SignedData digestAlgorithms field includes the identifiers of the 187 message digest algorithms used by one or more signer. There MAY be 188 any number of elements in the collection, including zero. When 189 signing with Ed25519, the digestAlgorithm SHOULD include id-sha512, 190 and if present, the algorithm parameters field MUST be absent. When 191 signing with Ed448, the digestAlgorithm SHOULD include 192 id-shake256-len, and if present, the algorithm parameters field MUST 193 also be present, and the parameter MUST contain 512, encoded as a 194 positive integer value. 196 The SignerInfo digestAlgorithm field includes the identifier of the 197 message digest algorithms used by the signer. When signing with 198 Ed25519, the digestAlgorithm MUST be id-sha512, and the algorithm 199 parameters field MUST be absent. When signing with Ed448, the 200 digestAlgorithm MUST be id-shake256-len, the algorithm parameters 201 field MUST be present, and the parameter MUST contain 512, encoded as 202 a positive integer value. 204 The SignerInfo signedAttributes MUST include the message-digest 205 attribute as specified in Section 11.2 of [RFC5652]. When signing 206 with Ed25519, the message-digest attribute MUST contain the message 207 digest computed over the eContent value using SHA-512. When signing 208 with Ed448, the message-digest attribute MUST contain the message 209 digest computed over the eContent value using SHAKE256 with an output 210 length of 512 bits. 212 The SignerInfo signatureAlgorithm field MUST contain either 213 id-Ed25519 or id-Ed448, depending on the elliptic curve that was used 214 by the signer. The algorithm parameters field MUST be absent. 216 The SignerInfo signature field contains the octet string resulting 217 from the EdDSA private key signing operation. 219 3.2. Signed-data Conventions Without Signed Attributes 221 The SignedData digestAlgorithms field includes the identifiers of the 222 message digest algorithms used by one or more signer. There MAY be 223 any number of elements in the collection, including zero. When 224 signing with Ed25519, list of identifiers MAY include id-sha512, and 225 if present, the algorithm parameters field MUST be absent. When 226 signing with Ed448, list of identifiers MAY include id-shake256, and 227 if present, the algorithm parameters field MUST be absent. 229 The SignerInfo digestAlgorithm field includes the identifier of the 230 message digest algorithms used by the signer. When signing with 231 Ed25519, the digestAlgorithm MUST be id-sha512, and the algorithm 232 parameters field MUST be absent. When signing with Ed448, the 233 digestAlgorithm MUST be id-shake256, and the algorithm parameters 234 field MUST be absent. 236 NOTE: Either id-sha512 or id-shake256 is used as part to the 237 private key signing operation. However, the private key signing 238 operation does not take a message digest computed with one of 239 these algorithms as an input. 241 The SignerInfo signatureAlgorithm field MUST contain either 242 id-Ed25519 or id-Ed448, depending on the elliptic curve that was used 243 by the signer. The algorithm parameters field MUST be absent. 245 The SignerInfo signature field contains the octet string resulting 246 from the EdDSA private key signing operation. 248 4. Implementation Considerations 250 The EdDSA specification [EDDSA] includes the following warning. It 251 deserves highlighting, especially when signed-data is used without 252 signed attributes and the content to be signed might be quite large: 254 PureEdDSA requires two passes over the input. Many existing APIs, 255 protocols, and environments assume digital signature algorithms 256 only need one pass over the input, and may have API or bandwidth 257 concerns supporting anything else. 259 5. Security Considerations 261 Implementations must protect the EdDSA private key. Compromise of 262 the EdDSA private key may result in the ability to forge signatures. 264 The generation of EdDSA private key relies on random numbers. The 265 use of inadequate pseudo-random number generators (PRNGs) to generate 266 these values can result in little or no security. An attacker may 267 find it much easier to reproduce the PRNG environment that produced 268 the keys, searching the resulting small set of possibilities, rather 269 than brute force searching the whole key space. The generation of 270 quality random numbers is difficult. RFC 4086 [RANDOM] offers 271 important guidance in this area. 273 Unlike DSA and ECDSA, EdDSA does not require the generation of a 274 random value for each signature operation. 276 Using the same private key for different algorithms has the potential 277 of allowing an attacker to get extra information about the private 278 key. For this reason, the same private key SHOULD NOT be used with 279 more than one EdDSA set of parameters. For example, do not use the 280 same private key with PureEdDSA and HashEdDSA. 282 When computing signatures, the same hash function should be used for 283 all operations. This reduces the number of failure points in the 284 signature process. 286 6. IANA Considerations 288 This document requires no actions by IANA. 290 7. Acknowledgements 292 Many thanks to Jim Schaad and Daniel Migault for the careful review 293 and comment on the draft document. Thanks to Quynh Dang for 294 coordinating the object identifiers assignment by NIST. 296 8. Normative References 298 [CMS] Housley, R., "Cryptographic Message Syntax (CMS)", 299 RFC 5652, September 2009. 301 [CURDLE-PKIX] 302 Josefsson, S., and J. Schaad, "Algorithm Identifiers for 303 Ed25519, Ed25519ph, Ed448, Ed448ph, X25519 and X448 for 304 use in the Internet X.509 Public Key Infrastructure", 305 draft-ietf-curdle-pkix-02, 31 October 2016, 306 Work-in-progress. 308 [EDDSA] Josefsson, S. and I. Liusvaara, "Edwards-curve Digital 309 Signature Algorithm (EdDSA)", RFC 8032, January 2017. 311 [FIPS180] National Institute of Standards and Technology, U.S. 312 Department of Commerce, "Secure Hash Standard", Federal 313 Information Processing Standard (FIPS) 180-3, October 314 2008. 316 [FIPS202] National Institute of Standards and Technology, U.S. 317 Department of Commerce, "SHA-3 Standard: Permutation-Based 318 Hash and Extendable-Output Functions", Federal Information 319 Processing Standard (FIPS) 202, August 2015. 321 [STDWORDS] Bradner, S., "Key words for use in RFCs to Indicate 322 Requirement Levels", BCP 14, RFC 2119, March 1997. 324 [X680] ITU-T, "Information technology -- Abstract Syntax Notation 325 One (ASN.1): Specification of basic notation", ITU-T 326 Recommendation X.680, 2015. 328 [X690] ITU-T, "Information technology -- ASN.1 encoding rules: 329 Specification of Basic Encoding Rules (BER), Canonical 330 Encoding Rules (CER) and Distinguished Encoding Rules 331 (DER)", ITU-T Recommendation X.690, 2015. 333 9. Informative References 335 [RANDOM] Eastlake, D., Schiller, J., and S. Crocker, "Randomness 336 Requirements for Security", RFC 4086, June 2005. 338 [RFC6234] Eastlake 3rd, D. and T. Hansen, "US Secure Hash Algorithms 339 (SHA and SHA-based HMAC and HKDF)", RFC 6234, May 2011. 341 Author's Address 343 Russ Housley 344 918 Spring Knoll Drive 345 Herndon, VA 20170 346 USA 347 housley@vigilsec.com