idnits 2.17.1 draft-yasskin-http-origin-signed-responses-09.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: ---------------------------------------------------------------------------- == There is 1 instance of lines with non-ascii characters in the document. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** There are 10 instances of too long lines in the document, the longest one being 38 characters in excess of 72. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (27 July 2020) is 1367 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: '100' on line 516 == Missing Reference: '-1' is mentioned on line 518, but not defined -- Possible downref: Non-RFC (?) normative reference: ref. 'FETCH' -- Possible downref: Normative reference to a draft: ref. 'I-D.ietf-httpbis-variants' -- Possible downref: Non-RFC (?) normative reference: ref. 'POSIX' ** Obsolete normative reference: RFC 3230 (Obsoleted by RFC 9530) ** Obsolete normative reference: RFC 6844 (Obsoleted by RFC 8659) ** 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 8032 -- Possible downref: Non-RFC (?) normative reference: ref. 'URL' == Outdated reference: A later version (-19) exists of draft-ietf-httpbis-cache-10 == Outdated reference: A later version (-02) exists of draft-yasskin-wpack-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: 10 errors (**), 0 flaws (~~), 5 warnings (==), 10 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 27 July 2020 5 Expires: 28 January 2021 7 Signed HTTP Exchanges 8 draft-yasskin-http-origin-signed-responses-09 10 Abstract 12 This document specifies how a server can send an HTTP exchange--a 13 request URL, content negotiation information, and a response--with 14 signatures that vouch for that exchange's authenticity. These 15 signatures can be verified against an origin's certificate to 16 establish that the exchange is authoritative for an origin even if it 17 was transferred over a connection that isn't. The signatures can 18 also be used in other ways 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/ 28 (https://lists.w3.org/Archives/Public/ietf-http-wg/). 30 The source code and issues list for this draft can be found in 31 https://github.com/WICG/webpackage (https://github.com/WICG/ 32 webpackage). 34 Status of This Memo 36 This Internet-Draft is submitted in full conformance with the 37 provisions of BCP 78 and BCP 79. 39 Internet-Drafts are working documents of the Internet Engineering 40 Task Force (IETF). Note that other groups may also distribute 41 working documents as Internet-Drafts. The list of current Internet- 42 Drafts is at https://datatracker.ietf.org/drafts/current/. 44 Internet-Drafts are draft documents valid for a maximum of six months 45 and may be updated, replaced, or obsoleted by other documents at any 46 time. It is inappropriate to use Internet-Drafts as reference 47 material or to cite them other than as "work in progress." 48 This Internet-Draft will expire on 28 January 2021. 50 Copyright Notice 52 Copyright (c) 2020 IETF Trust and the persons identified as the 53 document authors. All rights reserved. 55 This document is subject to BCP 78 and the IETF Trust's Legal 56 Provisions Relating to IETF Documents (https://trustee.ietf.org/ 57 license-info) in effect on the date of publication of this document. 58 Please review these documents carefully, as they describe your rights 59 and restrictions with respect to this document. Code Components 60 extracted from this document must include Simplified BSD License text 61 as described in Section 4.e of the Trust Legal Provisions and are 62 provided without warranty as 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 . . . . . . . . . . . . . . . . . . 6 70 3.1.1. Examples . . . . . . . . . . . . . . . . . . . . . . 7 71 3.1.2. Open Questions . . . . . . . . . . . . . . . . . . . 9 72 3.2. CBOR representation of exchange response headers . . . . 9 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 . . . . . . . . . . . . . . . . . . . 12 77 3.5.1. Open Questions . . . . . . . . . . . . . . . . . . . 16 78 3.6. Updating signature validity . . . . . . . . . . . . . . . 16 79 3.6.1. Examples . . . . . . . . . . . . . . . . . . . . . . 17 80 3.7. The Accept-Signature header . . . . . . . . . . . . . . . 19 81 3.7.1. Integrity identifiers . . . . . . . . . . . . . . . . 20 82 3.7.2. Key type identifiers . . . . . . . . . . . . . . . . 20 83 3.7.3. Key value identifiers . . . . . . . . . . . . . . . . 20 84 3.7.4. Examples . . . . . . . . . . . . . . . . . . . . . . 21 85 3.7.5. Open Questions . . . . . . . . . . . . . . . . . . . 21 86 4. Cross-origin trust . . . . . . . . . . . . . . . . . . . . . 22 87 4.1. Uncached header fields . . . . . . . . . . . . . . . . . 23 88 4.1.1. Stateful header fields . . . . . . . . . . . . . . . 24 89 4.2. Certificate Requirements . . . . . . . . . . . . . . . . 25 90 4.2.1. Extensions to the CAA Record: cansignhttpexchanges 91 Parameter . . . . . . . . . . . . . . . . . . . . . . 26 92 5. Transferring a signed exchange . . . . . . . . . . . . . . . 26 93 5.1. Same-origin response . . . . . . . . . . . . . . . . . . 27 94 5.1.1. Serialized headers for a same-origin response . . . . 27 95 5.1.2. The Signed-Headers Header . . . . . . . . . . . . . . 28 97 5.2. HTTP/2 extension for cross-origin Server Push . . . . . . 28 98 5.2.1. Indicating support for cross-origin Server Push . . . 28 99 5.2.2. NO_TRUSTED_EXCHANGE_SIGNATURE error code . . . . . . 29 100 5.2.3. Validating a cross-origin Push . . . . . . . . . . . 29 101 5.3. application/signed-exchange format . . . . . . . . . . . 30 102 5.3.1. Cross-origin trust in application/signed-exchange . . 31 103 5.3.2. Example . . . . . . . . . . . . . . . . . . . . . . . 32 104 5.3.3. Open Questions . . . . . . . . . . . . . . . . . . . 32 105 6. Security considerations . . . . . . . . . . . . . . . . . . . 32 106 6.1. Over-signing . . . . . . . . . . . . . . . . . . . . . . 32 107 6.1.1. Session fixation . . . . . . . . . . . . . . . . . . 33 108 6.1.2. Misleading content . . . . . . . . . . . . . . . . . 33 109 6.2. Off-path attackers . . . . . . . . . . . . . . . . . . . 33 110 6.2.1. Mis-issued certificates . . . . . . . . . . . . . . . 33 111 6.2.2. Stolen private keys . . . . . . . . . . . . . . . . . 34 112 6.3. Downgrades . . . . . . . . . . . . . . . . . . . . . . . 35 113 6.4. Signing oracles are permanent . . . . . . . . . . . . . . 35 114 6.5. Unsigned headers . . . . . . . . . . . . . . . . . . . . 35 115 6.6. application/signed-exchange . . . . . . . . . . . . . . . 36 116 6.7. Key re-use with TLS . . . . . . . . . . . . . . . . . . . 36 117 6.8. Content sniffing . . . . . . . . . . . . . . . . . . . . 36 118 7. Privacy considerations . . . . . . . . . . . . . . . . . . . 37 119 7.1. Visibility of resource requests . . . . . . . . . . . . . 38 120 7.2. User ID transfer . . . . . . . . . . . . . . . . . . . . 39 121 8. IANA considerations . . . . . . . . . . . . . . . . . . . . . 39 122 8.1. Signature Header Field Registration . . . . . . . . . . . 39 123 8.2. Accept-Signature Header Field Registration . . . . . . . 39 124 8.3. Signed-Headers Header Field Registration . . . . . . . . 40 125 8.4. HTTP/2 Settings . . . . . . . . . . . . . . . . . . . . . 40 126 8.5. HTTP/2 Error code . . . . . . . . . . . . . . . . . . . . 40 127 8.6. Internet Media Type application/signed-exchange . . . . . 41 128 8.7. Internet Media Type application/cert-chain+cbor . . . . . 42 129 8.8. The cansignhttpexchanges CAA Parameter . . . . . . . . . 43 130 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 43 131 9.1. Normative References . . . . . . . . . . . . . . . . . . 43 132 9.2. Informative References . . . . . . . . . . . . . . . . . 46 133 Appendix A. Use cases . . . . . . . . . . . . . . . . . . . . . 49 134 A.1. PUSHed subresources . . . . . . . . . . . . . . . . . . . 49 135 A.2. Explicit use of a content distributor for subresources . 49 136 A.3. Subresource Integrity . . . . . . . . . . . . . . . . . . 50 137 A.4. Binary Transparency . . . . . . . . . . . . . . . . . . . 50 138 A.5. Static Analysis . . . . . . . . . . . . . . . . . . . . . 51 139 A.6. Offline websites . . . . . . . . . . . . . . . . . . . . 51 140 Appendix B. Requirements . . . . . . . . . . . . . . . . . . . . 51 141 B.1. Proof of origin . . . . . . . . . . . . . . . . . . . . . 51 142 B.1.1. Certificate constraints . . . . . . . . . . . . . . . 51 143 B.1.2. Signature constraints . . . . . . . . . . . . . . . . 52 144 B.1.3. Retrieving the certificate . . . . . . . . . . . . . 52 146 B.2. How much to sign . . . . . . . . . . . . . . . . . . . . 53 147 B.2.1. Conveying the signed headers . . . . . . . . . . . . 53 148 B.3. Response lifespan . . . . . . . . . . . . . . . . . . . . 54 149 B.3.1. Certificate revocation . . . . . . . . . . . . . . . 54 150 B.3.2. Response downgrade attacks . . . . . . . . . . . . . 54 151 B.4. Low implementation complexity . . . . . . . . . . . . . . 55 152 B.4.1. Limited choices . . . . . . . . . . . . . . . . . . . 55 153 B.4.2. Bounded-buffering integrity checking . . . . . . . . 55 154 Appendix C. Determining validity using cache control . . . . . . 56 155 C.1. Example of updating cache control . . . . . . . . . . . . 56 156 C.2. Downsides of updating cache control . . . . . . . . . . . 57 157 Appendix D. Change Log . . . . . . . . . . . . . . . . . . . . . 57 158 Appendix E. Acknowledgements . . . . . . . . . . . . . . . . . . 60 159 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 60 161 1. Introduction 163 Signed HTTP exchanges provide a way to prove the authenticity of a 164 resource in cases where the transport layer isn't sufficient. This 165 can be used in several ways: 167 * When signed by a certificate ([RFC5280]) that's trusted for an 168 origin, an exchange can be treated as authoritative for that 169 origin, even if it was transferred over a connection that isn't 170 authoritative (Section 9.1 of [RFC7230]) for that origin. See 171 Appendix A.1 and Appendix A.2. 173 * A top-level resource can use a public key to identify an expected 174 publisher for particular subresources, a system known as 175 Subresource Integrity ([SRI]). An exchange's signature provides 176 the matching proof of authorship. See Appendix A.3. 178 * A signature can vouch for the exchange in some way, for example 179 that it appears in a transparency log or that static analysis 180 indicates that it omits certain attacks. See Appendix A.4 and 181 Appendix A.5. 183 Subsequent work toward the use cases in [I-D.yasskin-wpack-use-cases] 184 will provide a way to group signed exchanges into bundles that can be 185 transmitted and stored together, but single signed exchanges are 186 useful enough to standardize on their own. 188 2. Terminology 190 Absolute URL A string for which the URL parser 191 (https://url.spec.whatwg.org/#concept-url-parser) ([URL]), when 192 run without a base URL, returns a URL rather than a failure, and 193 for which that URL has a null fragment. This is similar to the 194 absolute-URL string (https://url.spec.whatwg.org/#absolute-url- 195 string) concept defined by ([URL]) but might not include exactly 196 the same strings. 198 Author The entity that wrote the content in a particular resource. 199 This specification deals with publishers rather than authors. 201 Publisher The entity that controls the server for a particular 202 origin [RFC6454]. The publisher can get a CA to issue 203 certificates for their private keys and can run a TLS server for 204 their origin. 206 Exchange (noun) An HTTP request URL, content negotiation 207 information, and an HTTP response. This can be encoded into a 208 request message from a client with its matching response from a 209 server, into the request in a PUSH_PROMISE with its matching 210 response stream, or into the dedicated format in Section 5.3, 211 which uses [I-D.ietf-httpbis-variants] to encode the content 212 negotiation information. This is not quite the same meaning as 213 defined by Section 8 of [RFC7540], which assumes the content 214 negotiation information is embedded into HTTP request headers. 216 Intermediate An entity that fetches signed HTTP exchanges from a 217 publisher or another intermediate and forwards them to another 218 intermediate or a client. 220 Client An entity that uses a signed HTTP exchange and needs to be 221 able to prove that the publisher vouched for it as coming from its 222 claimed origin. 224 Unix time Defined by [POSIX] section 4.16 225 (http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/ 226 V1_chap04.html#tag_04_16). 228 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 229 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 230 "OPTIONAL" in this document are to be interpreted as described in BCP 231 14 [RFC2119] [RFC8174] when, and only when, they appear in all 232 capitals, as shown here. 234 3. Signing an exchange 236 In the response of an HTTP exchange the server MAY include a 237 "Signature" header field (Section 3.1) holding a list of one or more 238 parameterised signatures that vouch for the content of the exchange. 239 Exactly which content the signature vouches for can depend on how the 240 exchange is transferred (Section 5). 242 The client categorizes each signature as "valid" or "invalid" by 243 validating that signature with its certificate or public key and 244 other metadata against the exchange's URL, response headers, and 245 content (Section 3.5). This validity then informs higher-level 246 protocols. 248 Each signature is parameterised with information to let a client 249 fetch assurance that a signed exchange is still valid, in the face of 250 revoked certificates and newly-discovered vulnerabilities. This 251 assurance can be bundled back into the signed exchange and forwarded 252 to another client, which won't have to re-fetch this validity 253 information for some period of time. 255 3.1. The Signature Header 257 The "Signature" header field conveys a list of signatures for an 258 exchange, each one accompanied by information about how to determine 259 the authority of and refresh that signature. Each signature directly 260 signs the exchange's URL and response headers and identifies one of 261 those headers that enforces the integrity of the exchange's payload. 263 The "Signature" header is a Structured Header as defined by 264 [I-D.ietf-httpbis-header-structure]. Its value MUST be a 265 parameterised list (Section 3.4 of 266 [I-D.ietf-httpbis-header-structure]). Its ABNF is: 268 Signature = sh-param-list 270 Each parameterised identifier in the list MUST have parameters named 271 "sig", "integrity", "validity-url", "date", and "expires". Each 272 parameterised identifier MUST also have either "cert-url" and "cert- 273 sha256" parameters or an "ed25519key" parameter. This specification 274 gives no meaning to the identifier itself, which can be used as a 275 human-readable identifier for the signature (however, this is likely 276 to change soon; see Section 3.1.2, Paragraph 1). The present 277 parameters MUST have the following values: 279 "sig" Byte sequence (Section 3.10 of 280 [I-D.ietf-httpbis-header-structure]) holding the signature of most 281 of these parameters and the exchange's URL and response headers. 283 "integrity" A string (Section 3.8 of 285 [I-D.ietf-httpbis-header-structure]) containing a "/"-separated 286 sequence of names starting with the lowercase name of the response 287 header field that guards the response payload's integrity. The 288 meaning of subsequent names depends on the response header field, 289 but for the "digest" header field, the single following name is 290 the name of the digest algorithm that guards the payload's 291 integrity. 293 "cert-url" A string (Section 3.8 of 294 [I-D.ietf-httpbis-header-structure]) containing an absolute URL 295 (Section 2) with a scheme of "https" or "data". 297 "cert-sha256" Byte sequence (Section 3.10 of 298 [I-D.ietf-httpbis-header-structure]) holding the SHA-256 hash of 299 the first certificate found at "cert-url". 301 "ed25519key" Byte sequence (Section 3.10 of 302 [I-D.ietf-httpbis-header-structure]) holding an Ed25519 public key 303 ([RFC8032]). 305 "validity-url" A string (Section 3.8 of 306 [I-D.ietf-httpbis-header-structure]) containing an absolute URL 307 (Section 2) with a scheme of "https". 309 "date" and "expires" An integer (Section 3.6 of 310 [I-D.ietf-httpbis-header-structure]) representing a Unix time. 312 The "cert-url" parameter is _not_ signed, so intermediates can update 313 it with a pointer to a cached version. 315 3.1.1. Examples 317 The following header is included in the response for an exchange with 318 effective request URI "https://example.com/resource.html". Newlines 319 are added for readability. 321 Signature: 322 sig1; 323 sig=*MEUCIQDXlI2gN3RNBlgFiuRNFpZXcDIaUpX6HIEwcZEc0cZYLAIga9DsVOMM+g5YpwEBdGW3sS+bvnmAJJiSMwhuBdqp5UY=*; 324 integrity="digest/mi-sha256"; 325 validity-url="https://example.com/resource.validity.1511128380"; 326 cert-url="https://example.com/oldcerts"; 327 cert-sha256=*W7uB969dFW3Mb5ZefPS9Tq5ZbH5iSmOILpjv2qEArmI=*; 328 date=1511128380; expires=1511733180, 329 sig2; 330 sig=*MEQCIGjZRqTRf9iKNkGFyzRMTFgwf/BrY2ZNIP/dykhUV0aYAiBTXg+8wujoT4n/W+cNgb7pGqQvIUGYZ8u8HZJ5YH26Qg==*; 331 integrity="digest/mi-sha256"; 332 validity-url="https://example.com/resource.validity.1511128380"; 333 cert-url="https://example.com/newcerts"; 334 cert-sha256=*J/lEm9kNRODdCmINbvitpvdYKNQ+YgBj99DlYp4fEXw=*; 335 date=1511128380; expires=1511733180, 336 srisig; 337 sig=*lGZVaJJM5f2oGczFlLmBdKTDL+QADza4BgeO494ggACYJOvrof6uh5OJCcwKrk7DK+LBch0jssDYPp5CLc1SDA==*; 338 integrity="digest/mi-sha256"; 339 validity-url="https://example.com/resource.validity.1511128380"; 340 ed25519key=*zsSevyFsxyZHiUluVBDd4eypdRLTqyWRVOJuuKUz+A8=* 341 date=1511128380; expires=1511733180, 342 thirdpartysig; 343 sig=*MEYCIQCNxJzn6Rh2fNxsobktir8TkiaJYQFhWTuWI1i4PewQaQIhAMs2TVjc4rTshDtXbgQEOwgj2mRXALhfXPztXgPupii+*; 344 integrity="digest/mi-sha256"; 345 validity-url="https://thirdparty.example.com/resource.validity.1511161860"; 346 cert-url="https://thirdparty.example.com/certs"; 347 cert-sha256=*UeOwUPkvxlGRTyvHcsMUN0A2oNsZbU8EUvg8A9ZAnNc=*; 348 date=1511133060; expires=1511478660, 350 There are 4 signatures: 2 from different secp256r1 certificates 351 within "https://example.com/", one using a raw ed25519 public key 352 that's also controlled by "example.com", and a fourth using a 353 secp256r1 certificate owned by "thirdparty.example.com". 355 All 4 signatures rely on the "Digest" response header with the mi- 356 sha256 digest algorithm to guard the integrity of the response 357 payload. 359 The signatures include a "validity-url" that includes the first time 360 the resource was seen. This allows multiple versions of a resource 361 at the same URL to be updated with new signatures, which allows 362 clients to avoid transferring extra data while the old versions don't 363 have known security bugs. 365 The certificates at "https://example.com/oldcerts" and 366 "https://example.com/newcerts" have "subjectAltName"s of 367 "example.com", meaning that if they and their signatures validate, 368 the exchange can be trusted as having an origin of 369 "https://example.com/". The publisher might be using two 370 certificates because their readers have disjoint sets of roots in 371 their trust stores. 373 The publisher signed with all three certificates at the same time, so 374 they share a validity range: 7 days starting at 2017-11-19 21:53 UTC. 376 The publisher then requested an additional signature from 377 "thirdparty.example.com", which did some validation or processing and 378 then signed the resource at 2017-11-19 23:11 UTC. 379 "thirdparty.example.com" only grants 4-day signatures, so clients 380 will need to re-validate more often. 382 3.1.2. Open Questions 384 The next revision of [I-D.ietf-httpbis-header-structure] will provide 385 a way to parameterise byte sequences, at which point the signature 386 itself is likely to become the main list item. 388 Should the cert-url and validity-url be lists so that intermediates 389 can offer a cache without losing the original URLs? Putting lists in 390 dictionary fields is more complex than 391 [I-D.ietf-httpbis-header-structure] allows, so they're single items 392 for now. 394 3.2. CBOR representation of exchange response headers 396 To sign an exchange's response headers, they need to be serialized 397 into a byte string. Since intermediaries and distributors 398 (Appendix A.2) might rearrange, add, or just reserialize headers, we 399 can't use the literal bytes of the headers as this serialization. 400 Instead, this section defines a CBOR representation that can be 401 embedded into other CBOR, canonically serialized (Section 3.4), and 402 then signed. 404 The CBOR representation of a set of response metadata and headers is 405 the CBOR ([RFC7049]) map with the following mappings: 407 * The byte string ':status' to the byte string containing the 408 response's 3-digit status code, and 410 * For each response header field, the header field's lowercase name 411 as a byte string to the header field's value as a byte string. 413 3.2.1. Example 415 Given the HTTP exchange: 417 GET / HTTP/1.1 418 Host: example.com 419 Accept: */* 421 HTTP/1.1 200 422 Content-Type: text/html 423 Digest: mi-sha256=dcRDgR2GM35DluAV13PzgnG6+pvQwPywfFvAu1UeFrs= 424 Signed-Headers: "content-type", "digest" 426 427 428 ... 430 The cbor representation consists of the following item, represented 431 using the extended diagnostic notation from [CDDL] appendix G: 433 { 434 'digest': 'mi-sha256=dcRDgR2GM35DluAV13PzgnG6+pvQwPywfFvAu1UeFrs=', 435 ':status': '200', 436 'content-type': 'text/html' 437 } 439 3.3. Loading a certificate chain 441 The resource at a signature's "cert-url" MUST have the "application/ 442 cert-chain+cbor" content type, MUST be canonically-encoded CBOR 443 (Section 3.4), and MUST match the following CDDL: 445 cert-chain = [ 446 "📜⛓", ; U+1F4DC U+26D3 447 + augmented-certificate 448 ] 449 augmented-certificate = { 450 cert: bytes, 451 ? ocsp: bytes, 452 ? sct: bytes, 453 * tstr => any, 454 } 456 The first map (second item) in the CBOR array is treated as the end- 457 entity certificate, and the client will attempt to build a path 458 ([RFC5280]) to it from a trusted root using the other certificates in 459 the chain. 461 1. Each "cert" value MUST be a DER-encoded X.509v3 certificate 462 ([RFC5280]). Other key/value pairs in the same array item define 463 properties of this certificate. 465 2. The first certificate's "ocsp" value MUST be a complete, DER- 466 encoded OCSP response for that certificate (using the ASN.1 type 467 "OCSPResponse" defined in [RFC6960]). Subsequent certificates 468 MUST NOT have an "ocsp" value. 470 3. Each certificate's "sct" value if any MUST be a 471 "SignedCertificateTimestampList" for that certificate as defined 472 by Section 3.3 of [RFC6962]. 474 Loading a "cert-url" takes a "forceFetch" flag. The client MUST: 476 1. Let "raw-chain" be the result of fetching ([FETCH]) "cert-url". 477 If "forceFetch" is _not_ set, the fetch can be fulfilled from a 478 cache using normal HTTP semantics [RFC7234]. If this fetch 479 fails, return "invalid". 481 2. Let "certificate-chain" be the array of certificates and 482 properties produced by parsing "raw-chain" using the CDDL above. 483 If any of the requirements above aren't satisfied, return 484 "invalid". Note that this validation requirement might be 485 impractical to completely achieve due to certificate validation 486 implementations that don't enforce DER encoding or other standard 487 constraints. 489 3. Return "certificate-chain". 491 3.4. Canonical CBOR serialization 493 Within this specification, the canonical serialization of a CBOR item 494 uses the following rules derived from Section 3.9 of [RFC7049] with 495 erratum 4964 applied: 497 * Integers and the lengths of arrays, maps, and strings MUST use the 498 smallest possible encoding. 500 * Items MUST NOT be encoded with indefinite length. 502 * The keys in every map MUST be sorted in the bytewise lexicographic 503 order of their canonical encodings. For example, the following 504 keys are correctly sorted: 506 1. 10, encoded as 0A. 508 2. 100, encoded as 18 64. 510 3. -1, encoded as 20. 512 4. "z", encoded as 61 7A. 514 5. "aa", encoded as 62 61 61. 516 6. [100], encoded as 81 18 64. 518 7. [-1], encoded as 81 20. 520 8. false, encoded as F4. 522 Note: this specification does not use floating point, tags, or other 523 more complex data types, so it doesn't need rules to canonicalize 524 those. 526 3.5. Signature validity 528 The client MUST parse the "Signature" header field as the 529 parameterised list (Section 4.2.5 of 530 [I-D.ietf-httpbis-header-structure]) described in Section 3.1. If an 531 error is thrown during this parsing or any of the requirements 532 described there aren't satisfied, the exchange has no valid 533 signatures. Otherwise, each member of this list represents a 534 signature with parameters. 536 The client MUST use the following algorithm to determine whether each 537 signature with parameters is invalid or potentially-valid for an 538 exchange's 540 * "requestUrl", a byte sequence that can be parsed into the 541 exchange's effective request URI (Section 5.5 of [RFC7230]), 543 * "responseHeaders", a byte sequence holding the canonical 544 serialization (Section 3.4) of the CBOR representation 545 (Section 3.2) of the exchange's response metadata and headers, and 547 * "payload", a stream of bytes constituting the exchange's payload 548 body (Section 3.3 of [RFC7230]). Note that the payload body is 549 the message body with any transfer encodings removed. 551 Potentially-valid results include: 553 * The signed headers of the exchange so that higher-level protocols 554 can avoid relying on unsigned headers, and 556 * Either a certificate chain or a public key so that a higher-level 557 protocol can determine whether it's actually valid. 559 This algorithm accepts a "forceFetch" flag that avoids the cache when 560 fetching URLs. A client that determines that a potentially-valid 561 certificate chain is actually invalid due to an expired OCSP response 562 MAY retry with "forceFetch" set to retrieve an updated OCSP from the 563 original server. 565 1. Let: 567 * "signature" be the signature (byte sequence in the 568 parameterised identifier's "sig" parameter). 570 * "integrity" be the signature's "integrity" parameter. 572 * "validity-url" be the signature's "validity-url" parameter. 574 * "cert-url" be the signature's "cert-url" parameter, if any. 576 * "cert-sha256" be the signature's "cert-sha256" parameter, if 577 any. 579 * "ed25519key" be the signature's "ed25519key" parameter, if 580 any. 582 * "date" be the signature's "date" parameter, interpreted as a 583 Unix time. 585 * "expires" be the signature's "expires" parameter, interpreted 586 as a Unix time. 588 2. Set "publicKey" and "signing-alg" depending on which key fields 589 are present: 591 1. If "cert-url" is present: 593 1. Let "certificate-chain" be the result of loading the 594 certificate chain at "cert-url" passing the "forceFetch" 595 flag (Section 3.3). If this returns "invalid", return 596 "invalid". 598 2. Let "main-certificate" be the first certificate in 599 "certificate-chain". 601 3. Set "publicKey" to "main-certificate"'s public key. 603 4. If "publicKey" is an RSA key, return "invalid". 605 5. If "publicKey" is a key using the secp256r1 elliptic 606 curve, set "signing-alg" to ecdsa_secp256r1_sha256 as 607 defined in Section 4.2.3 of [RFC8446]. 609 6. Otherwise, either return "invalid" or set "signing-alg" 610 to a non-legacy signing algorithm defined by TLS 1.3 or 611 later ([RFC8446]). This choice MUST depend only on 612 "publicKey"'s type and not on any other context. 614 2. If "ed25519key" is present, set "publicKey" to "ed25519key" 615 and "signing-alg" to ed25519, as defined by [RFC8032] 617 3. If "expires" is more than 7 days (604800 seconds) after "date", 618 return "invalid". 620 4. If the current time is before "date" or after "expires", return 621 "invalid". 623 5. Let "message" be the concatenation of the following byte 624 strings. This matches the [RFC8446] format to avoid cross- 625 protocol attacks if anyone uses the same key in a TLS 626 certificate and an exchange-signing certificate. 628 1. A string that consists of octet 32 (0x20) repeated 64 times. 630 2. A context string: the ASCII encoding of "HTTP Exchange 1". 632 Note: RFC EDITOR PLEASE DELETE THIS NOTE; The implementation 633 of the final RFC MUST use this context string, but 634 implementations of drafts MUST NOT use it and MUST use 635 another draft-specific string beginning with "HTTP Exchange 636 1 " instead. This ensures that signers can predict how 637 their signatures will be used. 639 3. A single 0 byte which serves as a separator. 641 4. If "cert-sha256" is set, a byte holding the value 32 642 followed by the 32 bytes of the value of "cert-sha256". 643 Otherwise a 0 byte. 645 5. The 8-byte big-endian encoding of the length in bytes of 646 "validity-url", followed by the bytes of "validity-url". 648 6. The 8-byte big-endian encoding of "date". 650 7. The 8-byte big-endian encoding of "expires". 652 8. The 8-byte big-endian encoding of the length in bytes of 653 "requestUrl", followed by the bytes of "requestUrl". 655 9. The 8-byte big-endian encoding of the length in bytes of 656 "responseHeaders", followed by the bytes of 657 "responseHeaders". 659 6. If "cert-url" is present and the SHA-256 hash of "main- 660 certificate"'s "cert_data" is not equal to "cert-sha256" (whose 661 presence was checked when the "Signature" header field was 662 parsed), return "invalid". 664 Note that this intentionally differs from TLS 1.3, which signs 665 the entire certificate chain in its Certificate Verify 666 (Section 4.4.3 of [RFC8446]), in order to allow updating the 667 stapled OCSP response without updating signatures at the same 668 time. 670 7. If "signature" is not a valid signature of "message" by 671 "publicKey" using "signing-alg", return "invalid". 673 8. If "headers", interpreted according to Section 3.2, does not 674 contain a "Content-Type" response header field (Section 3.1.1.5 675 of [RFC7231]), return "invalid". 677 Clients MUST interpret the signed payload as this specified 678 media type instead of trying to sniff a media type from the 679 bytes of the payload, for example by attaching an "X-Content- 680 Type-Options: nosniff" header field ([FETCH]) to the extracted 681 response. 683 9. If "integrity" names a header field and parameter that is not 684 present in "responseHeaders" or which the client cannot use to 685 check the integrity of "payload" (for example, the header field 686 is new and hasn't been implemented yet), then return "invalid". 687 If the selected header field provides integrity guarantees 688 weaker than SHA-256, return "invalid". If validating integrity 689 using the selected header field requires the client to process 690 records larger than 16384 bytes, return "invalid". Clients MUST 691 implement at least the "Digest" header field with its "mi- 692 sha256" digest algorithm (Section 3 of [I-D.thomson-http-mice]). 694 Note: RFC EDITOR PLEASE DELETE THIS NOTE; Implementations of 695 drafts of this RFC MUST recognize the draft spelling of the 696 content encoding and digest algorithm specified by 697 [I-D.thomson-http-mice] until that draft is published as an RFC. 698 For example, implementations of draft-thomson-http-mice-03 would 699 use "mi-sha256-03" and MUST NOT use "mi-sha256" itself. This 700 ensures that final implementations don't need to handle 701 compatibility with implementations of early drafts of that 702 content encoding. 704 If "payload" doesn't match the integrity information in the 705 header described by "integrity", return "invalid". 707 10. Return "potentially-valid" with whichever is present of 708 "certificate-chain" or "ed25519key". 710 Note that the above algorithm can determine that an exchange's 711 headers are potentially-valid before the exchange's payload is 712 received. Similarly, if "integrity" identifies a header field and 713 parameter like "Digest:mi-sha256" ([I-D.thomson-http-mice]) that can 714 incrementally validate the payload, early parts of the payload can be 715 determined to be potentially-valid before later parts of the payload. 716 Higher-level protocols MAY process parts of the exchange that have 717 been determined to be potentially-valid as soon as that determination 718 is made but MUST NOT process parts of the exchange that are not yet 719 potentially-valid. Similarly, as the higher-level protocol 720 determines that parts of the exchange are actually valid, the client 721 MAY process those parts of the exchange and MUST wait to process 722 other parts of the exchange until they too are determined to be 723 valid. 725 3.5.1. Open Questions 727 Should the signed message use the TLS format (with an initial 64 728 spaces) even though these certificates can't be used in TLS servers? 730 3.6. Updating signature validity 732 Both OCSP responses and signatures are designed to expire a short 733 time after they're signed, so that revoked certificates and signed 734 exchanges with known vulnerabilities are distrusted promptly. 736 This specification provides no way to update OCSP responses by 737 themselves. Instead, clients need to re-fetch the "cert-url" 738 (Section 3.5, Paragraph 6) to get a chain including a newer OCSP 739 response. 741 The "validity-url" parameter (Section 3.1) of the signatures provides 742 a way to fetch new signatures or learn where to fetch a complete 743 updated exchange. 745 Each version of a signed exchange SHOULD have its own validity URLs, 746 since each version needs different signatures and becomes obsolete at 747 different times. 749 The resource at a "validity-url" is "validity data", a CBOR map 750 matching the following CDDL ([CDDL]): 752 validity = { 753 ? signatures: [ + bytes ] 754 ? update: { 755 ? size: uint, 756 } 757 ] 759 The elements of the "signatures" array are parameterised identifiers 760 (Section 4.2.6 of [I-D.ietf-httpbis-header-structure]) meant to 761 replace the signatures within the "Signature" header field pointing 762 to this validity data. If the signed exchange contains a bug severe 763 enough that clients need to stop using the content, the "signatures" 764 array MUST NOT be present. 766 If the the "update" map is present, that indicates that a new version 767 of the signed exchange is available at its effective request URI 768 (Section 5.5 of [RFC7230]) and can give an estimate of the size of 769 the updated exchange ("update.size"). If the signed exchange is 770 currently the most recent version, the "update" SHOULD NOT be 771 present. 773 If both the "signatures" and "update" fields are present, clients can 774 use the estimated size to decide whether to update the whole resource 775 or just its signatures. 777 3.6.1. Examples 779 For example, say a signed exchange whose URL is "https://example.com/ 780 resource" has the following "Signature" header field (with line 781 breaks included and irrelevant fields omitted for ease of reading). 783 Signature: 784 sig1; 785 sig=*MEUCIQ...*; 786 ... 787 validity-url="https://example.com/resource.validity.1511157180"; 788 cert-url="https://example.com/oldcerts"; 789 date=1511128380; expires=1511733180, 790 sig2; 791 sig=*MEQCIG...*; 792 ... 793 validity-url="https://example.com/resource.validity.1511157180"; 794 cert-url="https://example.com/newcerts"; 795 date=1511128380; expires=1511733180, 796 thirdpartysig; 797 sig=*MEYCIQ...*; 798 ... 799 validity-url="https://thirdparty.example.com/resource.validity.1511161860"; 800 cert-url="https://thirdparty.example.com/certs"; 801 date=1511478660; expires=1511824260 803 At 2017-11-27 11:02 UTC, "sig1" and "sig2" have expired, but 804 "thirdpartysig" doesn't exipire until 23:11 that night, so the client 805 needs to fetch "https://example.com/resource.validity.1511157180" 806 (the "validity-url" of "sig1" and "sig2") if it wishes to update 807 those signatures. This URL might contain: 809 { 810 "signatures": [ 811 'sig1; ' 812 'sig=*MEQCIC/I9Q+7BZFP6cSDsWx43pBAL0ujTbON/+7RwKVk+ba5AiB3FSFLZqpzmDJ0NumNwN04pqgJZE99fcK86UjkPbj4jw==*; ' 813 'validity-url="https://example.com/resource.validity.1511157180"; ' 814 'integrity="digest/mi-sha256"; ' 815 'cert-url="https://example.com/newcerts"; ' 816 'cert-sha256=*J/lEm9kNRODdCmINbvitpvdYKNQ+YgBj99DlYp4fEXw=*; ' 817 'date=1511733180; expires=1512337980' 818 ], 819 "update": { 820 "size": 5557452 821 } 822 } 823 This indicates that the client could fetch a newer version at 824 "https://example.com/resource" (the original URL of the exchange), or 825 that the validity period of the old version can be extended by 826 replacing the first two of the original signatures (the ones with a 827 validity-url of "https://example.com/resource.validity.1511157180") 828 with the single new signature provided. (This might happen at the 829 end of a migration to a new root certificate.) The signatures of the 830 updated signed exchange would be: 832 Signature: 833 sig1; 834 sig=*MEQCIC...*; 835 ... 836 validity-url="https://example.com/resource.validity.1511157180"; 837 cert-url="https://example.com/newcerts"; 838 date=1511733180; expires=1512337980, 839 thirdpartysig; 840 sig=*MEYCIQ...*; 841 ... 842 validity-url="https://thirdparty.example.com/resource.validity.1511161860"; 843 cert-url="https://thirdparty.example.com/certs"; 844 date=1511478660; expires=1511824260 846 "https://example.com/resource.validity.1511157180" could also expand 847 the set of signatures if its "signatures" array contained more than 2 848 elements. 850 3.7. The Accept-Signature header 852 "Signature" header fields cost on the order of 300 bytes for ECDSA 853 signatures, so servers might prefer to avoid sending them to clients 854 that don't intend to use them. A client can send the "Accept- 855 Signature" header field to indicate that it does intend to take 856 advantage of any available signatures and to indicate what kinds of 857 signatures it supports. 859 When a server receives an "Accept-Signature" header field in a client 860 request, it SHOULD reply with any available "Signature" header fields 861 for its response that the "Accept-Signature" header field indicates 862 the client supports. However, if the "Accept-Signature" value 863 violates a requirement in this section, the server MUST behave as if 864 it hadn't received any "Accept-Signature" header at all. 866 The "Accept-Signature" header field is a Structured Header as defined 867 by [I-D.ietf-httpbis-header-structure]. Its value MUST be a 868 parameterised list (Section 3.4 of 869 [I-D.ietf-httpbis-header-structure]). Its ABNF is: 871 Accept-Signature = sh-param-list 873 The order of identifiers in the "Accept-Signature" list is not 874 significant. Identifiers, ignoring any initial "-" character, MUST 875 NOT be duplicated. 877 Each identifier in the "Accept-Signature" header field's value 878 indicates that a feature of the "Signature" header field 879 (Section 3.1) is supported. If the identifier begins with a "-" 880 character, it instead indicates that the feature named by the rest of 881 the identifier is not supported. Unknown identifiers and parameters 882 MUST be ignored because new identifiers and new parameters on 883 existing identifiers may be defined by future specifications. 885 3.7.1. Integrity identifiers 887 Identifiers starting with "digest/" indicate that the client supports 888 the "Digest" header field ([RFC3230]) with the parameter from the 889 HTTP Digest Algorithm Values Registry 890 (https://www.iana.org/assignments/http-dig-alg/http-dig-alg.xhtml) 891 registry named in lower-case by the rest of the identifier. For 892 example, "digest/mi-blake2" indicates support for Merkle integrity 893 with the as-yet-unspecified mi-blake2 parameter, and "-digest/mi- 894 sha256" indicates non-support for Merkle integrity with the mi-sha256 895 content encoding. 897 If the "Accept-Signature" header field is present, servers SHOULD 898 assume support for "digest/mi-sha256" unless the header field states 899 otherwise. 901 3.7.2. Key type identifiers 903 Identifiers starting with "ecdsa/" indicate that the client supports 904 certificates holding ECDSA public keys on the curve named in lower- 905 case by the rest of the identifier. 907 If the "Accept-Signature" header field is present, servers SHOULD 908 assume support for "ecdsa/secp256r1" unless the header field states 909 otherwise. 911 3.7.3. Key value identifiers 913 The "ed25519key" identifier has parameters indicating the public keys 914 that will be used to validate the returned signature. Each 915 parameter's name is re-interpreted as a byte sequence (Section 3.10 916 of [I-D.ietf-httpbis-header-structure]) encoding a prefix of the 917 public key. For example, if the client will validate signatures 918 using the public key whose base64 encoding is 919 "11qYAYKxCrfVS/7TyWQHOg7hcvPapiMlrwIaaPcHURo=", valid "Accept- 920 Signature" header fields include: 922 Accept-Signature: ..., ed25519key; *11qYAYKxCrfVS/7TyWQHOg7hcvPapiMlrwIaaPcHURo=* 923 Accept-Signature: ..., ed25519key; *11qYAYKxCrfVS/7TyWQHOg==* 924 Accept-Signature: ..., ed25519key; *11qYAQ==* 925 Accept-Signature: ..., ed25519key; ** 927 but not 929 Accept-Signature: ..., ed25519key; *11qYA===* 931 because 5 bytes isn't a valid length for encoded base64, and not 933 Accept-Signature: ..., ed25519key; 11qYAQ 935 because it doesn't start or end with the "*"s that indicate a byte 936 sequence. 938 Note that "ed25519key; **" is an empty prefix, which matches all 939 public keys, so it's useful in subresource integrity (Appendix A.3) 940 cases like "" where the public 941 key isn't known until the matching "