idnits 2.17.1 draft-yasskin-http-origin-signed-responses-03.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 : ---------------------------------------------------------------------------- ** There are 11 instances of too long lines in the document, the longest one being 35 characters in excess of 72. ** The abstract seems to contain references ([2], [1]), which it shouldn't. Please replace those with straight textual mentions of the documents in question. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (March 05, 2018) is 2234 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Looks like a reference, but probably isn't: '1' on line 1786 -- Looks like a reference, but probably isn't: '2' on line 1788 -- Looks like a reference, but probably isn't: '3' on line 1790 -- Looks like a reference, but probably isn't: '4' on line 1793 -- Looks like a reference, but probably isn't: '5' on line 1795 -- Looks like a reference, but probably isn't: '100' on line 494 == Missing Reference: '-1' is mentioned on line 496, but not defined -- Looks like a reference, but probably isn't: '6' on line 1797 -- Looks like a reference, but probably isn't: '7' on line 1799 -- Looks like a reference, but probably isn't: '8' on line 1801 -- Looks like a reference, but probably isn't: '9' on line 1803 -- Looks like a reference, but probably isn't: '10' on line 1865 -- Looks like a reference, but probably isn't: '11' on line 1879 -- Looks like a reference, but probably isn't: '12' on line 1894 -- Looks like a reference, but probably isn't: '13' on line 1916 -- Looks like a reference, but probably isn't: '14' on line 1917 -- Looks like a reference, but probably isn't: '15' on line 1933 -- Looks like a reference, but probably isn't: '16' on line 2040 -- Looks like a reference, but probably isn't: '17' on line 2084 -- Looks like a reference, but probably isn't: '18' on line 2092 == Unused Reference: 'HTML' is defined on line 1594, but no explicit reference was found in the text -- Possible downref: Non-RFC (?) normative reference: ref. 'FETCH' -- Possible downref: Non-RFC (?) normative reference: ref. 'HTML' == Outdated reference: A later version (-08) exists of draft-ietf-cbor-cddl-02 == Outdated reference: A later version (-19) exists of draft-ietf-httpbis-header-structure-04 == Outdated reference: A later version (-28) exists of draft-ietf-tls-tls13-26 == Outdated reference: A later version (-03) exists of draft-thomson-http-mice-02 -- Possible downref: Non-RFC (?) normative reference: ref. 'POSIX' ** Obsolete normative reference: RFC 2560 (Obsoleted by RFC 6960) ** Obsolete normative reference: RFC 3230 (Obsoleted by RFC 9530) ** Obsolete normative reference: RFC 6962 (Obsoleted by RFC 9162) ** Obsolete normative reference: RFC 7049 (Obsoleted by RFC 8949) ** Obsolete normative reference: RFC 7230 (Obsoleted by RFC 9110, RFC 9112) ** Obsolete normative reference: RFC 7231 (Obsoleted by RFC 9110) ** Obsolete normative reference: RFC 7234 (Obsoleted by RFC 9111) ** Obsolete normative reference: RFC 7540 (Obsoleted by RFC 9113) ** Downref: Normative reference to an Informational RFC: RFC 8017 ** Downref: Normative reference to an Informational RFC: RFC 8032 == Outdated reference: A later version (-12) exists of draft-cavage-http-signatures-09 == Outdated reference: A later version (-06) exists of draft-ietf-httpbis-http2-secondary-certs-00 == Outdated reference: A later version (-02) exists of draft-yasskin-webpackage-use-cases-00 -- Obsolete informational reference (is this intentional?): RFC 2965 (Obsoleted by RFC 6265) -- Obsolete informational reference (is this intentional?): RFC 7235 (Obsoleted by RFC 9110) -- Obsolete informational reference (is this intentional?): RFC 7615 (Obsoleted by RFC 9110) Summary: 12 errors (**), 0 flaws (~~), 10 warnings (==), 27 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group J. Yasskin 3 Internet-Draft Google 4 Intended status: Standards Track March 05, 2018 5 Expires: September 6, 2018 7 Signed HTTP Exchanges 8 draft-yasskin-http-origin-signed-responses-03 10 Abstract 12 This document specifies how a server can send an HTTP request/ 13 response pair, known as an exchange, with signatures that vouch for 14 that exchange's authenticity. These signatures can be verified 15 against an origin's certificate to establish that the exchange is 16 authoritative for an origin even if it was transferred over a 17 connection that isn't. The signatures can also be used in other ways 18 described in the appendices. 20 These signatures contain countermeasures against downgrade and 21 protocol-confusion attacks. 23 Note to Readers 25 Discussion of this draft takes place on the HTTP working group 26 mailing list (ietf-http-wg@w3.org), which is archived at 27 https://lists.w3.org/Archives/Public/ietf-http-wg/ [1]. 29 The source code and issues list for this draft can be found in 30 https://github.com/WICG/webpackage [2]. 32 Status of This Memo 34 This Internet-Draft is submitted in full conformance with the 35 provisions of BCP 78 and BCP 79. 37 Internet-Drafts are working documents of the Internet Engineering 38 Task Force (IETF). Note that other groups may also distribute 39 working documents as Internet-Drafts. The list of current Internet- 40 Drafts is at https://datatracker.ietf.org/drafts/current/. 42 Internet-Drafts are draft documents valid for a maximum of six months 43 and may be updated, replaced, or obsoleted by other documents at any 44 time. It is inappropriate to use Internet-Drafts as reference 45 material or to cite them other than as "work in progress." 47 This Internet-Draft will expire on September 6, 2018. 49 Copyright Notice 51 Copyright (c) 2018 IETF Trust and the persons identified as the 52 document authors. All rights reserved. 54 This document is subject to BCP 78 and the IETF Trust's Legal 55 Provisions Relating to IETF Documents 56 (https://trustee.ietf.org/license-info) in effect on the date of 57 publication of this document. Please review these documents 58 carefully, as they describe your rights and restrictions with respect 59 to this document. Code Components extracted from this document must 60 include Simplified BSD License text as described in Section 4.e of 61 the Trust Legal Provisions and are provided without warranty as 62 described in the Simplified BSD License. 64 Table of Contents 66 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 67 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 4 68 3. Signing an exchange . . . . . . . . . . . . . . . . . . . . . 5 69 3.1. The Signature Header . . . . . . . . . . . . . . . . . . 5 70 3.1.1. Examples . . . . . . . . . . . . . . . . . . . . . . 6 71 3.1.2. Open Questions . . . . . . . . . . . . . . . . . . . 8 72 3.2. CBOR representation of exchange headers . . . . . . . . . 8 73 3.2.1. Example . . . . . . . . . . . . . . . . . . . . . . . 9 74 3.3. Loading a certificate chain . . . . . . . . . . . . . . . 10 75 3.4. Canonical CBOR serialization . . . . . . . . . . . . . . 11 76 3.5. Signature validity . . . . . . . . . . . . . . . . . . . 11 77 3.5.1. Open Questions . . . . . . . . . . . . . . . . . . . 15 78 3.6. Updating signature validity . . . . . . . . . . . . . . . 15 79 3.6.1. Examples . . . . . . . . . . . . . . . . . . . . . . 16 80 3.7. The Accept-Signature header . . . . . . . . . . . . . . . 18 81 3.7.1. Integrity labels . . . . . . . . . . . . . . . . . . 18 82 3.7.2. Key type labels . . . . . . . . . . . . . . . . . . . 19 83 3.7.3. Key value labels . . . . . . . . . . . . . . . . . . 19 84 3.7.4. Examples . . . . . . . . . . . . . . . . . . . . . . 20 85 3.7.5. Open Questions . . . . . . . . . . . . . . . . . . . 20 86 4. Cross-origin trust . . . . . . . . . . . . . . . . . . . . . 20 87 4.1. Stateful header fields . . . . . . . . . . . . . . . . . 21 88 4.2. Certificate Requirements . . . . . . . . . . . . . . . . 22 89 5. Transferring a signed exchange . . . . . . . . . . . . . . . 23 90 5.1. Same-origin response . . . . . . . . . . . . . . . . . . 23 91 5.1.1. Significant headers for a same-origin response . . . 24 92 5.1.2. The Signed-Headers Header . . . . . . . . . . . . . . 24 93 5.2. HTTP/2 extension for cross-origin Server Push . . . . . . 25 94 5.2.1. Indicating support for cross-origin Server Push . . . 25 95 5.2.2. NO_TRUSTED_EXCHANGE_SIGNATURE error code . . . . . . 25 96 5.2.3. Validating a cross-origin Push . . . . . . . . . . . 26 98 5.3. application/http-exchange+cbor format for HTTP/1 99 compatibility . . . . . . . . . . . . . . . . . . . . . . 26 100 5.3.1. Example . . . . . . . . . . . . . . . . . . . . . . . 28 101 5.3.2. Open Questions . . . . . . . . . . . . . . . . . . . 28 102 6. Security considerations . . . . . . . . . . . . . . . . . . . 28 103 6.1. Over-signing . . . . . . . . . . . . . . . . . . . . . . 29 104 6.1.1. Session fixation . . . . . . . . . . . . . . . . . . 29 105 6.1.2. Misleading content . . . . . . . . . . . . . . . . . 29 106 6.2. Off-path attackers . . . . . . . . . . . . . . . . . . . 30 107 6.3. Downgrades . . . . . . . . . . . . . . . . . . . . . . . 30 108 6.4. Signing oracles are permanent . . . . . . . . . . . . . . 30 109 6.5. Unsigned headers . . . . . . . . . . . . . . . . . . . . 30 110 6.6. application/http-exchange+cbor . . . . . . . . . . . . . 31 111 7. Privacy considerations . . . . . . . . . . . . . . . . . . . 31 112 8. IANA considerations . . . . . . . . . . . . . . . . . . . . . 32 113 8.1. Signature Header Field Registration . . . . . . . . . . . 32 114 8.2. HTTP/2 Settings . . . . . . . . . . . . . . . . . . . . . 32 115 8.3. HTTP/2 Error code . . . . . . . . . . . . . . . . . . . . 32 116 8.4. Internet Media Type application/http-exchange+cbor . . . 33 117 8.5. Internet Media Type application/cert-chain+cbor . . . . . 33 118 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 34 119 9.1. Normative References . . . . . . . . . . . . . . . . . . 34 120 9.2. Informative References . . . . . . . . . . . . . . . . . 37 121 9.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 39 122 Appendix A. Use cases . . . . . . . . . . . . . . . . . . . . . 39 123 A.1. PUSHed subresources . . . . . . . . . . . . . . . . . . . 39 124 A.2. Explicit use of a content distributor for subresources . 40 125 A.3. Subresource Integrity . . . . . . . . . . . . . . . . . . 41 126 A.4. Binary Transparency . . . . . . . . . . . . . . . . . . . 41 127 A.5. Static Analysis . . . . . . . . . . . . . . . . . . . . . 41 128 A.6. Offline websites . . . . . . . . . . . . . . . . . . . . 42 129 Appendix B. Requirements . . . . . . . . . . . . . . . . . . . . 42 130 B.1. Proof of origin . . . . . . . . . . . . . . . . . . . . . 42 131 B.1.1. Certificate constraints . . . . . . . . . . . . . . . 42 132 B.1.2. Signature constraints . . . . . . . . . . . . . . . . 42 133 B.1.3. Retrieving the certificate . . . . . . . . . . . . . 43 134 B.2. How much to sign . . . . . . . . . . . . . . . . . . . . 43 135 B.2.1. Conveying the signed headers . . . . . . . . . . . . 44 136 B.3. Response lifespan . . . . . . . . . . . . . . . . . . . . 45 137 B.3.1. Certificate revocation . . . . . . . . . . . . . . . 45 138 B.3.2. Response downgrade attacks . . . . . . . . . . . . . 45 139 Appendix C. Determining validity using cache control . . . . . . 46 140 C.1. Example of updating cache control . . . . . . . . . . . . 46 141 C.2. Downsides of updating cache control . . . . . . . . . . . 47 142 Appendix D. Change Log . . . . . . . . . . . . . . . . . . . . . 48 143 Appendix E. Acknowledgements . . . . . . . . . . . . . . . . . . 49 144 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 49 146 1. Introduction 148 Signed HTTP exchanges provide a way to prove the authenticity of a 149 resource in cases where the transport layer isn't sufficient. This 150 can be used in several ways: 152 o When signed by a certificate ([RFC5280]) that's trusted for an 153 origin, an exchange can be treated as authoritative for that 154 origin, even if it was transferred over a connection that isn't 155 authoritative (Section 9.1 of [RFC7230]) for that origin. See 156 Appendix A.1 and Appendix A.2. 158 o A top-level resource can use a public key to identify an expected 159 author for particular subresources, a system known as Subresource 160 Integrity ([SRI]). An exchange's signature provides the matching 161 proof of authorship. See Appendix A.3. 163 o A signature can vouch for the exchange in some way, for example 164 that it appears in a transparency log or that static analysis 165 indicates that it omits certain attacks. See Appendix A.4 and 166 Appendix A.5. 168 Subsequent work toward the use cases in 169 [I-D.yasskin-webpackage-use-cases] will provide a way to group signed 170 exchanges into bundles that can be transmitted and stored together, 171 but single signed exchanges are useful enough to standardize on their 172 own. 174 2. Terminology 176 Author The entity that controls the server for a particular origin 177 [RFC6454]. The author can get a CA to issue certificates for 178 their private keys and can run a TLS server for their origin. 180 Exchange (noun) An HTTP request/response pair. This can either be a 181 request from a client and the matching response from a server or 182 the request in a PUSH_PROMISE and its matching response stream. 183 Defined by Section 8 of [RFC7540]. 185 Intermediate An entity that fetches signed HTTP exchanges from an 186 author or another intermediate and forwards them to another 187 intermediate or a client. 189 Client An entity that uses a signed HTTP exchange and needs to be 190 able to prove that the author vouched for it as coming from its 191 claimed origin. 193 Unix time Defined by [POSIX] section 4.16 [3]. 195 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 196 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 197 "OPTIONAL" in this document are to be interpreted as described in BCP 198 14 [RFC2119] [RFC8174] when, and only when, they appear in all 199 capitals, as shown here. 201 3. Signing an exchange 203 In the response of an HTTP exchange the server MAY include a 204 "Signature" header field (Section 3.1) holding a list of one or more 205 parameterised signatures that vouch for the content of the exchange. 206 Exactly which content the signature vouches for can depend on how the 207 exchange is transferred (Section 5). 209 The client categorizes each signature as "valid" or "invalid" by 210 validating that signature with its certificate or public key and 211 other metadata against the exchange's headers and content 212 (Section 3.5). This validity then informs higher-level protocols. 214 Each signature is parameterised with information to let a client 215 fetch assurance that a signed exchange is still valid, in the face of 216 revoked certificates and newly-discovered vulnerabilities. This 217 assurance can be bundled back into the signed exchange and forwarded 218 to another client, which won't have to re-fetch this validity 219 information for some period of time. 221 3.1. The Signature Header 223 The "Signature" header field conveys a list of signatures for an 224 exchange, each one accompanied by information about how to determine 225 the authority of and refresh that signature. Each signature directly 226 signs the exchange's headers and identifies one of those headers that 227 enforces the integrity of the exchange's payload. 229 The "Signature" header is a Structured Header as defined by 230 [I-D.ietf-httpbis-header-structure]. Its value MUST be a list 231 (Section 4.8 of [I-D.ietf-httpbis-header-structure]) of parameterised 232 labels (Section 4.4 of [I-D.ietf-httpbis-header-structure]). 234 Each parameterised label MUST have parameters named "sig", 235 "integrity", "validityUrl", "date", and "expires". Each 236 parameterised label MUST also have either "certUrl" and "certSha256" 237 parameters or an "ed25519Key" parameter. This specification gives no 238 meaning to the label itself, which can be used as a human-readable 239 identifier for the signature (see Section 3.1.2, Paragraph 1). The 240 present parameters MUST have the following values: 242 "sig" Binary content (Section 4.5 of 243 [I-D.ietf-httpbis-header-structure]) holding the signature of most 244 of these parameters and the exchange's headers. 246 "integrity" A string (Section 4.2 of 247 [I-D.ietf-httpbis-header-structure]) containing the lowercase name 248 of the response header field that guards the response payload's 249 integrity. 251 "certUrl" A string (Section 4.2 of 252 [I-D.ietf-httpbis-header-structure]) containing a valid URL string 253 [4]. 255 "certSha256" Binary content (Section 4.5 of 256 [I-D.ietf-httpbis-header-structure]) holding the SHA-256 hash of 257 the first certificate found at "certUrl". 259 "ed25519Key" Binary content (Section 4.5 of 260 [I-D.ietf-httpbis-header-structure]) holding an Ed25519 public key 261 ([RFC8032]). 263 "validityUrl" A string (Section 4.2 of 264 [I-D.ietf-httpbis-header-structure]) containing a valid URL string 265 [5]. 267 "date" and "expires" An unsigned integer (Section 4.1 of 268 [I-D.ietf-httpbis-header-structure]) representing a Unix time. 270 The "certUrl" parameter is _not_ signed, so intermediates can update 271 it with a pointer to a cached version. 273 3.1.1. Examples 275 The following header is included in the response for an exchange with 276 effective request URI "https://example.com/resource.html". Newlines 277 are added for readability. 279 Signature: 280 sig1; 281 sig=*MEUCIQDXlI2gN3RNBlgFiuRNFpZXcDIaUpX6HIEwcZEc0cZYLAIga9DsVOMM+g5YpwEBdGW3sS+bvnmAJJiSMwhuBdqp5UY; 282 integrity="mi"; 283 validityUrl="https://example.com/resource.validity.1511128380"; 284 certUrl="https://example.com/oldcerts"; 285 certSha256=*W7uB969dFW3Mb5ZefPS9Tq5ZbH5iSmOILpjv2qEArmI; 286 date=1511128380; expires=1511733180, 287 sig2; 288 sig=*MEQCIGjZRqTRf9iKNkGFyzRMTFgwf/BrY2ZNIP/dykhUV0aYAiBTXg+8wujoT4n/W+cNgb7pGqQvIUGYZ8u8HZJ5YH26Qg; 289 integrity="mi"; 290 validityUrl="https://example.com/resource.validity.1511128380"; 291 certUrl="https://example.com/newcerts"; 292 certSha256=*J/lEm9kNRODdCmINbvitpvdYKNQ+YgBj99DlYp4fEXw; 293 date=1511128380; expires=1511733180, 294 srisig; 295 sig=*lGZVaJJM5f2oGczFlLmBdKTDL+QADza4BgeO494ggACYJOvrof6uh5OJCcwKrk7DK+LBch0jssDYPp5CLc1SDA 296 integrity="mi"; 297 validityUrl="https://example.com/resource.validity.1511128380"; 298 ed25519Key=*zsSevyFsxyZHiUluVBDd4eypdRLTqyWRVOJuuKUz+A8 299 date=1511128380; expires=1511733180, 300 thirdpartysig; 301 sig=*MEYCIQCNxJzn6Rh2fNxsobktir8TkiaJYQFhWTuWI1i4PewQaQIhAMs2TVjc4rTshDtXbgQEOwgj2mRXALhfXPztXgPupii+; 302 integrity="mi"; 303 validityUrl="https://thirdparty.example.com/resource.validity.1511161860"; 304 certUrl="https://thirdparty.example.com/certs"; 305 certSha256=*UeOwUPkvxlGRTyvHcsMUN0A2oNsZbU8EUvg8A9ZAnNc; 306 date=1511133060; expires=1511478660, 308 There are 4 signatures: 2 from different secp256r1 certificates 309 within "https://example.com/", one using a raw ed25519 public key 310 that's also controlled by "example.com", and a fourth using a 311 secp256r1 certificate owned by "thirdparty.example.com". 313 All 4 signatures rely on the "MI" response header to guard the 314 integrity of the response payload. This isn't strictly required-- 315 some signatures could use "MI" while others use "Digest"--but there's 316 not much benefit to mixing them. 318 The signatures include a "validityUrl" that includes the first time 319 the resource was seen. This allows multiple versions of a resource 320 at the same URL to be updated with new signatures, which allows 321 clients to avoid transferring extra data while the old versions don't 322 have known security bugs. 324 The certificates at "https://example.com/oldcerts" and 325 "https://example.com/newcerts" have "subjectAltName"s of 326 "example.com", meaning that if they and their signatures validate, 327 the exchange can be trusted as having an origin of 328 "https://example.com/". The author might be using two certificates 329 because their readers have disjoint sets of roots in their trust 330 stores. 332 The author signed with all three certificates at the same time, so 333 they share a validity range: 7 days starting at 2017-11-19 21:53 UTC. 335 The author then requested an additional signature from 336 "thirdparty.example.com", which did some validation or processing and 337 then signed the resource at 2017-11-19 23:11 UTC. 338 "thirdparty.example.com" only grants 4-day signatures, so clients 339 will need to re-validate more often. 341 3.1.2. Open Questions 343 [I-D.ietf-httpbis-header-structure] provides a way to parameterise 344 labels but not other supported types like binary content. If the 345 "Signature" header field is notionally a list of parameterised 346 signatures, maybe we should add a "parameterised binary content" 347 type. 349 Should the certUrl and validityUrl be lists so that intermediates can 350 offer a cache without losing the original URLs? Putting lists in 351 dictionary fields is more complex than 352 [I-D.ietf-httpbis-header-structure] allows, so they're single items 353 for now. 355 3.2. CBOR representation of exchange headers 357 To sign an exchange's headers, they need to be serialized into a byte 358 string. Since intermediaries and distributors (Appendix A.2) might 359 rearrange, add, or just reserialize headers, we can't use the literal 360 bytes of the headers as this serialization. Instead, this section 361 defines a CBOR representation that can be embedded into other CBOR, 362 canonically serialized (Section 3.4), and then signed. 364 The CBOR representation of an exchange "exchange"'s headers is the 365 CBOR ([RFC7049]) array with the following content: 367 1. The map mapping: 369 * The byte string ':method' to the byte string containing 370 "exchange"'s request's method. 372 * The byte string ':url' to the byte string containing 373 "exchange"'s request's effective request URI. 375 * For each request header field in "exchange", the header 376 field's name as a byte string to the header field's value as a 377 byte string. 379 2. The map mapping: 381 * the byte string ':status' to the byte string containing 382 "exchange"'s response's 3-digit status code, and 384 * for each response header field in "exchange", the header 385 field's name as a byte string to the header field's value as a 386 byte string. 388 3.2.1. Example 390 Given the HTTP exchange: 392 GET https://example.com/ HTTP/1.1 393 Accept: */* 395 HTTP/1.1 200 396 Content-Type: text/html 397 Digest: SHA-256=20addcf7368837f616d549f035bf6784ea6d4bf4817a3736cd2fc7a763897fe3 398 Signed-Headers: "content-type", "digest" 400 401 402 ... 404 The cbor representation consists of the following item, represented 405 using the extended diagnostic notation from [I-D.ietf-cbor-cddl] 406 appendix G: 408 [ 409 { 410 ':url': 'https://example.com/' 411 ':method': 'GET', 412 }, 413 { 414 'digest': 'SHA-256=20addcf7368837f616d549f035bf6784ea6d4bf4817a3736cd2fc7a763897fe3', 415 ':status': '200', 416 'content-type': 'text/html' 417 } 418 ] 419 3.3. Loading a certificate chain 421 The resource at a signature's "certUrl" MUST have the "application/ 422 cert-chain+cbor" content type, MUST be canonically-encoded CBOR 423 (Section 3.4), and MUST match the following CDDL: 425 cert-chain = [ 426 "📜⛓", ; U+1F4DC U+26D3 427 + { 428 cert: bytes, 429 ? ocsp: bytes, 430 ? sct: bytes, 431 * tstr => any, 432 } 433 ] 435 The first item in the CBOR array is treated as the end-entity 436 certificate, and the client will attempt to build a path ([RFC5280]) 437 to it from a trusted root using the other certificates in the chain. 439 1. Each "cert" value MUST be a DER-encoded X.509v3 certificate 440 ([RFC5280]). Other key/value pairs in the same array item define 441 properties of this certificate. 443 2. The first certificate's "ocsp" value if any MUST be a complete, 444 DER-encoded OCSP response for that certificate (using the ASN.1 445 type "OCSPResponse" defined in [RFC2560]). Subsequent 446 certificates MUST NOT have an "ocsp" value. 448 3. Each certificate's "sct" value MUST be a 449 "SignedCertificateTimestampList" for that certificate as defined 450 by Section 3.3 of [RFC6962]. 452 Loading a "certUrl" takes a "forceFetch" flag. The client MUST: 454 1. Let "raw-chain" be the result of fetching ([FETCH]) "certUrl". 455 If "forceFetch" is _not_ set, the fetch can be fulfilled from a 456 cache using normal HTTP semantics [RFC7234]. If this fetch 457 fails, return "invalid". 459 2. Let "certificate-chain" be the array of certificates and 460 properties produced by parsing "raw-chain" using the CDDL above. 461 If any of the requirements above aren't satisfied, return 462 "invalid". Note that this validation requirement might be 463 impractical to completely achieve due to certificate validation 464 implementations that don't enforce DER encoding or other standard 465 constraints. 467 3. Return "certificate-chain". 469 3.4. Canonical CBOR serialization 471 Within this specification, the canonical serialization of a CBOR item 472 uses the following rules derived from Section 3.9 of [RFC7049] with 473 erratum 4964 applied: 475 o Integers and the lengths of arrays, maps, and strings MUST use the 476 smallest possible encoding. 478 o Items MUST NOT be encoded with indefinite length. 480 o The keys in every map MUST be sorted in the bytewise lexicographic 481 order of their canonical encodings. For example, the following 482 keys are correctly sorted: 484 1. 10, encoded as 0A. 486 2. 100, encoded as 18 64. 488 3. -1, encoded as 20. 490 4. "z", encoded as 61 7A. 492 5. "aa", encoded as 62 61 61. 494 6. [100], encoded as 81 18 64. 496 7. [-1], encoded as 81 20. 498 8. false, encoded as F4. 500 Note: this specification does not use floating point, tags, or other 501 more complex data types, so it doesn't need rules to canonicalize 502 those. 504 3.5. Signature validity 506 The client MUST parse the "Signature" header field as the list of 507 parameterised values (Section 4.8.1 of 508 [I-D.ietf-httpbis-header-structure]) described in Section 3.1. If an 509 error is thrown during this parsing or any of the requirements 510 described there aren't satisfied, the exchange has no valid 511 signatures. Otherwise, each member of this list represents a 512 signature with parameters. 514 The client MUST use the following algorithm to determine whether each 515 signature with parameters is invalid or potentially-valid for an 516 "exchange". Potentially-valid results include: 518 o The signed headers of the exchange so that higher-level protocols 519 can avoid relying on unsigned headers, and 521 o Either a certificate chain or a public key so that a higher-level 522 protocol can determine whether it's actually valid. 524 This algorithm accepts a "forceFetch" flag that avoids the cache when 525 fetching URLs. A client that determines that a potentially-valid 526 certificate chain is actually invalid due to an expired OCSP response 527 MAY retry with "forceFetch" set to retrieve an updated OCSP from the 528 original server. 530 1. Let "payload" be the payload body (Section 3.3 of [RFC7230]) of 531 "exchange". Note that the payload body is the message body with 532 any transfer encodings removed. 534 2. Let: 536 * "signature" be the signature (binary content in the 537 parameterised label's "sig" parameter). 539 * "integrity" be the signature's "integrity" parameter. 541 * "validityUrl" be the signature's "validityUrl" parameter. 543 * "certUrl" be the signature's "certUrl" parameter, if any. 545 * "certSha256" be the signature's "certSha256" parameter, if 546 any. 548 * "ed25519Key" be the signature's "ed25519Key" parameter, if 549 any. 551 * "date" be the signature's "date" parameter, interpreted as a 552 Unix time. 554 * "expires" be the signature's "expires" parameter, interpreted 555 as a Unix time. 557 3. If "integrity" names a header field that is not present in 558 "exchange"'s response headers or which the client cannot use to 559 check the integrity of "payload" (for example, the header field 560 is new and hasn't been implemented yet), then return "invalid". 562 Clients MUST implement at least the "Digest" ([RFC3230]) and 563 "MI" ([I-D.thomson-http-mice]) header fields. 565 4. If "integrity" is "digest", and the "Digest" header field in 566 "exchange"'s response headers contains no digest-algorithms 567 (https://www.iana.org/assignments/http-dig-alg/http-dig- 568 alg.xhtml [6]) stronger than "SHA", then return "invalid". 570 5. Set "publicKey" and "signing-alg" depending on which key fields 571 are present: 573 1. If "certUrl" is present: 575 1. Let "certificate-chain" be the result of loading the 576 certificate chain at "certUrl" passing the "forceFetch" 577 flag (Section 3.3). If this returns "invalid", return 578 "invalid". 580 2. Let "main-certificate" be the first certificate in 581 "certificate-chain". 583 3. Set "publicKey" to "main-certificate"'s public key. 585 4. The client MUST define a partial function from public 586 key types to signing algorithms, and this function must 587 at the minimum include the following mappings: 589 RSA, 2048 bits: rsa_pss_rsae_sha256 or 590 rsa_pss_pss_sha256, as defined in Section 4.2.3 of 591 [I-D.ietf-tls-tls13], depending on which of the 592 rsaEncryption OID or RSASSA-PSS OID [RFC8017] is 593 used. 595 EC, with the secp256r1 curve: ecdsa_secp256r1_sha256 as 596 defined in Section 4.2.3 of [I-D.ietf-tls-tls13]. 598 EC, with the secp384r1 curve: ecdsa_secp384r1_sha384 as 599 defined in Section 4.2.3 of [I-D.ietf-tls-tls13]. 601 Set "signing-alg" to the result of applying this 602 function to the type of "main-certificate"'s public key. 603 If the function is undefined on this input, return 604 "invalid". 606 2. If "ed25519Key" is present, set "publicKey" to "ed25519Key" 607 and "signing-alg" to ed25519, as defined by [RFC8032] 609 6. If "expires" is more than 7 days (604800 seconds) after "date", 610 return "invalid". 612 7. If the current time is before "date" or after "expires", return 613 "invalid". 615 8. Let "message" be the concatenation of the following byte 616 strings: 618 1. A context string: the ASCII encoding of "HTTP Exchange". 620 2. A single 0 byte which serves as a separator. 622 3. The bytes of the canonical CBOR serialization (Section 3.4) 623 of a CBOR map mapping: 625 1. If "certSha256" is set: 627 1. The text string "certSha256" to the byte string 628 value of "certSha256". 630 2. The text string "validityUrl" to the byte string value 631 of "validityUrl". 633 3. The text string "date" to the integer value of "date". 635 4. The text string "expires" to the integer value of 636 "expires". 638 5. The text string "headers" to the CBOR representation 639 (Section 3.2) of "exchange"'s headers. 641 9. If "certUrl" is present and the SHA-256 hash of "main- 642 certificate"'s "cert_data" is not equal to "certSha256" (whose 643 presence was checked when the "Signature" header field was 644 parsed), return "invalid". 646 Note that this intentionally differs from TLS 1.3, which signs 647 the entire certificate chain in its Certificate Verify 648 (Section 4.4.3 of [I-D.ietf-tls-tls13]), in order to allow 649 updating the stapled OCSP response without updating signatures 650 at the same time. 652 10. If "signature" is a valid signature of "message" by "publicKey" 653 using "signing-alg", return "potentially-valid" with whichever 654 is present of "certificate-chain" or "ed25519Key". Otherwise, 655 return "invalid". 657 Note that the above algorithm can determine that an exchange's 658 headers are potentially-valid before the exchange's payload is 659 received. Similarly, if "integrity" identifies a header field like 660 "MI" ([I-D.thomson-http-mice]) that can incrementally validate the 661 payload, early parts of the payload can be determined to be 662 potentially-valid before later parts of the payload. Higher-level 663 protocols MAY process parts of the exchange that have been determined 664 to be potentially-valid as soon as that determination is made but 665 MUST NOT process parts of the exchange that are not yet potentially- 666 valid. Similarly, as the higher-level protocol determines that parts 667 of the exchange are actually valid, the client MAY process those 668 parts of the exchange and MUST wait to process other parts of the 669 exchange until they too are determined to be valid. 671 3.5.1. Open Questions 673 Should the signed message use the TLS format (with an initial 64 674 spaces) even though these certificates can't be used in TLS servers? 676 3.6. Updating signature validity 678 Both OCSP responses and signatures are designed to expire a short 679 time after they're signed, so that revoked certificates and signed 680 exchanges with known vulnerabilities are distrusted promptly. 682 This specification provides no way to update OCSP responses by 683 themselves. Instead, clients need to re-fetch the "certUrl" 684 (Section 3.5, Paragraph 4) to get a chain including a newer OCSP 685 response. 687 The "validityUrl" parameter (Paragraph 6) of the signatures provides 688 a way to fetch new signatures or learn where to fetch a complete 689 updated exchange. 691 Each version of a signed exchange SHOULD have its own validity URLs, 692 since each version needs different signatures and becomes obsolete at 693 different times. 695 The resource at a "validityUrl" is "validity data", a CBOR map 696 matching the following CDDL ([I-D.ietf-cbor-cddl]): 698 validity = { 699 ? signatures: [ + bytes ] 700 ? update: { 701 ? size: uint, 702 } 703 ] 704 The elements of the "signatures" array are parameterised labels 705 (Section 4.4 of [I-D.ietf-httpbis-header-structure]) meant to replace 706 the signatures within the "Signature" header field pointing to this 707 validity data. If the signed exchange contains a bug severe enough 708 that clients need to stop using the content, the "signatures" array 709 MUST NOT be present. 711 If the the "update" map is present, that indicates that a new version 712 of the signed exchange is available at its effective request URI 713 (Section 5.5 of [RFC7230]) and can give an estimate of the size of 714 the updated exchange ("update.size"). If the signed exchange is 715 currently the most recent version, the "update" SHOULD NOT be 716 present. 718 If both the "signatures" and "update" fields are present, clients can 719 use the estimated size to decide whether to update the whole resource 720 or just its signatures. 722 3.6.1. Examples 724 For example, say a signed exchange whose URL is "https://example.com/ 725 resource" has the following "Signature" header field (with line 726 breaks included and irrelevant fields omitted for ease of reading). 728 Signature: 729 sig1; 730 sig=*MEUCIQ...; 731 ... 732 validityUrl="https://example.com/resource.validity.1511157180"; 733 certUrl="https://example.com/oldcerts"; 734 date=1511128380; expires=1511733180, 735 sig2; 736 sig=*MEQCIG...; 737 ... 738 validityUrl="https://example.com/resource.validity.1511157180"; 739 certUrl="https://example.com/newcerts"; 740 date=1511128380; expires=1511733180, 741 thirdpartysig; 742 sig=*MEYCIQ...; 743 ... 744 validityUrl="https://thirdparty.example.com/resource.validity.1511161860"; 745 certUrl="https://thirdparty.example.com/certs"; 746 date=1511478660; expires=1511824260 748 At 2017-11-27 11:02 UTC, "sig1" and "sig2" have expired, but 749 "thirdpartysig" doesn't exipire until 23:11 that night, so the client 750 needs to fetch "https://example.com/resource.validity.1511157180" 751 (the "validityUrl" of "sig1" and "sig2") to update those signatures. 752 This URL might contain: 754 { 755 "signatures": [ 756 'sig1; ' 757 'sig=*MEQCIC/I9Q+7BZFP6cSDsWx43pBAL0ujTbON/+7RwKVk+ba5AiB3FSFLZqpzmDJ0NumNwN04pqgJZE99fcK86UjkPbj4jw; ' 758 'validityUrl="https://example.com/resource.validity.1511157180"; ' 759 'integrity="mi"; ' 760 'certUrl="https://example.com/newcerts"; ' 761 'certSha256=*J/lEm9kNRODdCmINbvitpvdYKNQ+YgBj99DlYp4fEXw; ' 762 'date=1511733180; expires=1512337980' 763 ], 764 "update": { 765 "size": 5557452 766 } 767 } 769 This indicates that the client could fetch a newer version at 770 "https://example.com/resource" (the original URL of the exchange), or 771 that the validity period of the old version can be extended by 772 replacing the first two of the original signatures (the ones with a 773 validityUrl of "https://example.com/resource.validity.1511157180") 774 with the single new signature provided. (This might happen at the 775 end of a migration to a new root certificate.) The signatures of the 776 updated signed exchange would be: 778 Signature: 779 sig1; 780 sig=*MEQCIC...; 781 ... 782 validityUrl="https://example.com/resource.validity.1511157180"; 783 certUrl="https://example.com/newcerts"; 784 date=1511733180; expires=1512337980, 785 thirdpartysig; 786 sig=*MEYCIQ...; 787 ... 788 validityUrl="https://thirdparty.example.com/resource.validity.1511161860"; 789 certUrl="https://thirdparty.example.com/certs"; 790 date=1511478660; expires=1511824260 792 "https://example.com/resource.validity.1511157180" could also expand 793 the set of signatures if its "signatures" array contained more than 2 794 elements. 796 3.7. The Accept-Signature header 798 "Signature" header fields cost on the order of 300 bytes for ECDSA 799 signatures, so servers might prefer to avoid sending them to clients 800 that don't intend to use them. A client can send the "Accept- 801 Signature" header field to indicate that it does intend to take 802 advantage of any available signatures and to indicate what kinds of 803 signatures it supports. 805 When a server receives an "Accept-Signature" header field in a client 806 request, it SHOULD reply with any available "Signature" header fields 807 for its response that the "Accept-Signature" header field indicates 808 the client supports. However, if the "Accept-Signature" value 809 violates a requirement in this section, the server MUST behave as if 810 it hadn't received any "Accept-Signature" header at all. 812 The "Accept-Signature" header field is a Structured Header as defined 813 by [I-D.ietf-httpbis-header-structure]. Its value MUST be a list 814 (Section 4.8 of [I-D.ietf-httpbis-header-structure]) of parameterised 815 labels (Section 4.4 of [I-D.ietf-httpbis-header-structure]). The 816 order of labels in the "Accept-Signature" list is not significant. 817 Labels, ignoring any initial "-" character, MUST NOT be duplicated. 819 Each label in the "Accept-Signature" header field's value indicates 820 that a feature of the "Signature" header field (Section 3.1) is 821 supported. If the label begins with a "-" character, it instead 822 indicates that the feature named by the rest of the label is not 823 supported. Unknown labels and parameters MUST be ignored because new 824 labels and new parameters on existing labels may be defined by future 825 specifications. 827 3.7.1. Integrity labels 829 Labels starting with "digest/" indicate that the client supports the 830 "Digest" header field ([RFC3230]) with the digest-algorithm from the 831 https://www.iana.org/assignments/http-dig-alg/http-dig-alg.xhtml [7] 832 registry named in lower-case by the rest of the label. For example, 833 "digest/sha-512" indicates support for the SHA-512 digest algorithm, 834 and "-digest/sha-256" indicates non-support for the SHA-256 digest 835 algorithm. 837 Labels starting with "mi/" indicate that the client supports the "MI" 838 header field ([I-D.thomson-http-mice]) with the parameter from the 839 HTTP MI Parameter Registry registry named in lower-case by the rest 840 of the label. For example, "mi/mi-blake2" indicates support for 841 Merkle integrity with the as-yet-unspecified mi-blake2 parameter, and 842 "-digest/mi-sha256" indicates non-support for Merkle integrity with 843 the mi-sha256 content encoding. 845 If the "Accept-Signature" header field is present, servers SHOULD 846 assume support for "digest/sha-256" and "mi/mi-sha256" unless the 847 header field states otherwise. 849 3.7.2. Key type labels 851 Labels starting with "rsa/" indicate that the client supports 852 certificates holding RSA public keys with a number of bits indicated 853 by the digits after the "/". 855 Labels starting with "ecdsa/" indicate that the client supports 856 certificates holding ECDSA public keys on the curve named in lower- 857 case by the rest of the label. 859 If the "Accept-Signature" header field is present, servers SHOULD 860 assume support for "rsa/2048", "ecdsa/secp256r1", and "ecdsa/ 861 secp384r1" unless the header field states otherwise. 863 3.7.3. Key value labels 865 The "ed25519key" label has parameters indicating the public keys that 866 will be used to validate the returned signature. Each parameter's 867 name is re-interpreted as binary content (Section 4.5 of 868 [I-D.ietf-httpbis-header-structure]) encoding a prefix of the public 869 key. For example, if the client will validate signatures using the 870 public key whose base64 encoding is 871 "11qYAYKxCrfVS/7TyWQHOg7hcvPapiMlrwIaaPcHURo", valid "Accept- 872 Signature" header fields include: 874 Accept-Signature: ..., ed25519key; *11qYAYKxCrfVS/7TyWQHOg7hcvPapiMlrwIaaPcHURo 875 Accept-Signature: ..., ed25519key; *11qYAYKxCrfVS/7TyWQHOg 876 Accept-Signature: ..., ed25519key; *11qYAQ 877 Accept-Signature: ..., ed25519key; * 879 but not 881 Accept-Signature: ..., ed25519key; *11qYA 883 because 5 bytes isn't a valid length for encoded base64, and not 885 Accept-Signature: ..., ed25519key; 11qYAQ 887 because it doesn't start with the "*" that indicates binary content. 889 Note that "ed25519key; *" is an empty prefix, which matches all 890 public keys, so it's useful in subresource integrity (Appendix A.3) 891 cases like "" where the public 892 key isn't known until the matching "