idnits 2.17.1 draft-yasskin-http-origin-signed-responses-04.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 13 instances of too long lines in the document, the longest one being 38 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 (June 14, 2018) is 2137 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 1837 -- Looks like a reference, but probably isn't: '2' on line 1839 -- Looks like a reference, but probably isn't: '3' on line 1841 -- Looks like a reference, but probably isn't: '4' on line 1844 -- Looks like a reference, but probably isn't: '5' on line 1846 -- Looks like a reference, but probably isn't: '6' on line 1848 -- Looks like a reference, but probably isn't: '100' on line 511 == Missing Reference: '-1' is mentioned on line 513, but not defined -- Looks like a reference, but probably isn't: '7' on line 1850 -- Looks like a reference, but probably isn't: '8' on line 1852 -- Looks like a reference, but probably isn't: '9' on line 1914 -- Looks like a reference, but probably isn't: '10' on line 1928 -- Looks like a reference, but probably isn't: '11' on line 1943 -- Looks like a reference, but probably isn't: '12' on line 1965 -- Looks like a reference, but probably isn't: '13' on line 1966 -- Looks like a reference, but probably isn't: '14' on line 1982 -- Looks like a reference, but probably isn't: '15' on line 2089 -- Looks like a reference, but probably isn't: '16' on line 2133 -- Looks like a reference, but probably isn't: '17' on line 2141 == Unused Reference: 'HTML' is defined on line 1647, but no explicit reference was found in the text == Unused Reference: 'DROWN' is defined on line 1748, but no explicit reference was found in the text == Unused Reference: 'ROBOT' is defined on line 1822, 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-06 == 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 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 8032 -- Possible downref: Non-RFC (?) normative reference: ref. 'URL' == Outdated reference: A later version (-12) exists of draft-cavage-http-signatures-10 == Outdated reference: A later version (-06) exists of draft-ietf-httpbis-http2-secondary-certs-01 == Outdated reference: A later version (-02) exists of draft-yasskin-webpackage-use-cases-01 -- 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 (~~), 11 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 June 14, 2018 5 Expires: December 16, 2018 7 Signed HTTP Exchanges 8 draft-yasskin-http-origin-signed-responses-04 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 December 16, 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 . . . . . . . . . . . . . . . . . . . 12 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 identifiers . . . . . . . . . . . . . . . . 19 82 3.7.2. Key type identifiers . . . . . . . . . . . . . . . . 19 83 3.7.3. Key value identifiers . . . . . . . . . . . . . . . . 19 84 3.7.4. Examples . . . . . . . . . . . . . . . . . . . . . . 20 85 3.7.5. Open Questions . . . . . . . . . . . . . . . . . . . 20 86 4. Cross-origin trust . . . . . . . . . . . . . . . . . . . . . 21 87 4.1. Stateful header fields . . . . . . . . . . . . . . . . . 22 88 4.2. Certificate Requirements . . . . . . . . . . . . . . . . 23 89 5. Transferring a signed exchange . . . . . . . . . . . . . . . 24 90 5.1. Same-origin response . . . . . . . . . . . . . . . . . . 24 91 5.1.1. Significant headers for a same-origin response . . . 24 92 5.1.2. The Signed-Headers Header . . . . . . . . . . . . . . 25 93 5.2. HTTP/2 extension for cross-origin Server Push . . . . . . 26 94 5.2.1. Indicating support for cross-origin Server Push . . . 26 95 5.2.2. NO_TRUSTED_EXCHANGE_SIGNATURE error code . . . . . . 26 96 5.2.3. Validating a cross-origin Push . . . . . . . . . . . 26 98 5.3. application/signed-exchange format . . . . . . . . . . . 27 99 5.3.1. Cross-origin trust in application/signed-exchange . . 28 100 5.3.2. Example . . . . . . . . . . . . . . . . . . . . . . . 28 101 5.3.3. Open Questions . . . . . . . . . . . . . . . . . . . 29 102 6. Security considerations . . . . . . . . . . . . . . . . . . . 29 103 6.1. Over-signing . . . . . . . . . . . . . . . . . . . . . . 29 104 6.1.1. Session fixation . . . . . . . . . . . . . . . . . . 30 105 6.1.2. Misleading content . . . . . . . . . . . . . . . . . 30 106 6.2. Off-path attackers . . . . . . . . . . . . . . . . . . . 30 107 6.3. Downgrades . . . . . . . . . . . . . . . . . . . . . . . 30 108 6.4. Signing oracles are permanent . . . . . . . . . . . . . . 31 109 6.5. Unsigned headers . . . . . . . . . . . . . . . . . . . . 31 110 6.6. application/signed-exchange . . . . . . . . . . . . . . . 31 111 7. Privacy considerations . . . . . . . . . . . . . . . . . . . 32 112 8. IANA considerations . . . . . . . . . . . . . . . . . . . . . 32 113 8.1. Signature Header Field Registration . . . . . . . . . . . 32 114 8.2. Accept-Signature Header Field Registration . . . . . . . 33 115 8.3. Signed-Headers Header Field Registration . . . . . . . . 33 116 8.4. HTTP/2 Settings . . . . . . . . . . . . . . . . . . . . . 33 117 8.5. HTTP/2 Error code . . . . . . . . . . . . . . . . . . . . 33 118 8.6. Internet Media Type application/signed-exchange . . . . . 34 119 8.7. Internet Media Type application/cert-chain+cbor . . . . . 35 120 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 36 121 9.1. Normative References . . . . . . . . . . . . . . . . . . 36 122 9.2. Informative References . . . . . . . . . . . . . . . . . 38 123 9.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . . 40 124 Appendix A. Use cases . . . . . . . . . . . . . . . . . . . . . 41 125 A.1. PUSHed subresources . . . . . . . . . . . . . . . . . . . 41 126 A.2. Explicit use of a content distributor for subresources . 41 127 A.3. Subresource Integrity . . . . . . . . . . . . . . . . . . 42 128 A.4. Binary Transparency . . . . . . . . . . . . . . . . . . . 42 129 A.5. Static Analysis . . . . . . . . . . . . . . . . . . . . . 43 130 A.6. Offline websites . . . . . . . . . . . . . . . . . . . . 43 131 Appendix B. Requirements . . . . . . . . . . . . . . . . . . . . 43 132 B.1. Proof of origin . . . . . . . . . . . . . . . . . . . . . 43 133 B.1.1. Certificate constraints . . . . . . . . . . . . . . . 43 134 B.1.2. Signature constraints . . . . . . . . . . . . . . . . 44 135 B.1.3. Retrieving the certificate . . . . . . . . . . . . . 44 136 B.2. How much to sign . . . . . . . . . . . . . . . . . . . . 45 137 B.2.1. Conveying the signed headers . . . . . . . . . . . . 45 138 B.3. Response lifespan . . . . . . . . . . . . . . . . . . . . 46 139 B.3.1. Certificate revocation . . . . . . . . . . . . . . . 46 140 B.3.2. Response downgrade attacks . . . . . . . . . . . . . 46 141 B.4. Low implementation complexity . . . . . . . . . . . . . . 47 142 B.4.1. Limited choices . . . . . . . . . . . . . . . . . . . 47 143 B.4.2. Bounded-buffering integrity checking . . . . . . . . 47 144 Appendix C. Determining validity using cache control . . . . . . 48 145 C.1. Example of updating cache control . . . . . . . . . . . . 48 146 C.2. Downsides of updating cache control . . . . . . . . . . . 49 147 Appendix D. Change Log . . . . . . . . . . . . . . . . . . . . . 49 148 Appendix E. Acknowledgements . . . . . . . . . . . . . . . . . . 51 149 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 51 151 1. Introduction 153 Signed HTTP exchanges provide a way to prove the authenticity of a 154 resource in cases where the transport layer isn't sufficient. This 155 can be used in several ways: 157 o When signed by a certificate ([RFC5280]) that's trusted for an 158 origin, an exchange can be treated as authoritative for that 159 origin, even if it was transferred over a connection that isn't 160 authoritative (Section 9.1 of [RFC7230]) for that origin. See 161 Appendix A.1 and Appendix A.2. 163 o A top-level resource can use a public key to identify an expected 164 publisher for particular subresources, a system known as 165 Subresource Integrity ([SRI]). An exchange's signature provides 166 the matching proof of authorship. See Appendix A.3. 168 o A signature can vouch for the exchange in some way, for example 169 that it appears in a transparency log or that static analysis 170 indicates that it omits certain attacks. See Appendix A.4 and 171 Appendix A.5. 173 Subsequent work toward the use cases in 174 [I-D.yasskin-webpackage-use-cases] will provide a way to group signed 175 exchanges into bundles that can be transmitted and stored together, 176 but single signed exchanges are useful enough to standardize on their 177 own. 179 2. Terminology 181 Author The entity that wrote the content in a particular resource. 182 This specification deals with publishers rather than authors. 184 Publisher The entity that controls the server for a particular 185 origin [RFC6454]. The publisher can get a CA to issue 186 certificates for their private keys and can run a TLS server for 187 their origin. 189 Exchange (noun) An HTTP request/response pair. This can either be a 190 request from a client and the matching response from a server or 191 the request in a PUSH_PROMISE and its matching response stream. 192 Defined by Section 8 of [RFC7540]. 194 Intermediate An entity that fetches signed HTTP exchanges from a 195 publisher or another intermediate and forwards them to another 196 intermediate or a client. 198 Client An entity that uses a signed HTTP exchange and needs to be 199 able to prove that the publisher vouched for it as coming from its 200 claimed origin. 202 Unix time Defined by [POSIX] section 4.16 [3]. 204 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 205 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 206 "OPTIONAL" in this document are to be interpreted as described in BCP 207 14 [RFC2119] [RFC8174] when, and only when, they appear in all 208 capitals, as shown here. 210 3. Signing an exchange 212 In the response of an HTTP exchange the server MAY include a 213 "Signature" header field (Section 3.1) holding a list of one or more 214 parameterised signatures that vouch for the content of the exchange. 215 Exactly which content the signature vouches for can depend on how the 216 exchange is transferred (Section 5). 218 The client categorizes each signature as "valid" or "invalid" by 219 validating that signature with its certificate or public key and 220 other metadata against the exchange's headers and content 221 (Section 3.5). This validity then informs higher-level protocols. 223 Each signature is parameterised with information to let a client 224 fetch assurance that a signed exchange is still valid, in the face of 225 revoked certificates and newly-discovered vulnerabilities. This 226 assurance can be bundled back into the signed exchange and forwarded 227 to another client, which won't have to re-fetch this validity 228 information for some period of time. 230 3.1. The Signature Header 232 The "Signature" header field conveys a list of signatures for an 233 exchange, each one accompanied by information about how to determine 234 the authority of and refresh that signature. Each signature directly 235 signs the exchange's headers and identifies one of those headers that 236 enforces the integrity of the exchange's payload. 238 The "Signature" header is a Structured Header as defined by 239 [I-D.ietf-httpbis-header-structure]. Its value MUST be a 240 parameterised list (Section 3.3 of 241 [I-D.ietf-httpbis-header-structure]). Its ABNF is: 243 Signature = sh-param-list 245 Each parameterised identifier in the list MUST have parameters named 246 "sig", "integrity", "validity-url", "date", and "expires". Each 247 parameterised identifier MUST also have either "cert-url" and "cert- 248 sha256" parameters or an "ed25519key" parameter. This specification 249 gives no meaning to the identifier itself, which can be used as a 250 human-readable identifier for the signature (see 251 Section 3.1.2, Paragraph 1). The present parameters MUST have the 252 following values: 254 "sig" Binary content (Section 3.9 of 255 [I-D.ietf-httpbis-header-structure]) holding the signature of most 256 of these parameters and the exchange's headers. 258 "integrity" A string (Section 3.7 of 259 [I-D.ietf-httpbis-header-structure]) containing the lowercase name 260 of the response header field that guards the response payload's 261 integrity. 263 "cert-url" A string (Section 3.7 of 264 [I-D.ietf-httpbis-header-structure]) containing an absolute-URL 265 string [4] ([URL]). 267 "cert-sha256" Binary content (Section 3.9 of 268 [I-D.ietf-httpbis-header-structure]) holding the SHA-256 hash of 269 the first certificate found at "cert-url". 271 "ed25519key" Binary content (Section 3.9 of 272 [I-D.ietf-httpbis-header-structure]) holding an Ed25519 public key 273 ([RFC8032]). 275 "validity-url" A string (Section 3.7 of 276 [I-D.ietf-httpbis-header-structure]) containing an absolute-URL 277 string [5] ([URL]). 279 "date" and "expires" An integer (Section 3.5 of 280 [I-D.ietf-httpbis-header-structure]) representing a Unix time. 282 The "cert-url" parameter is _not_ signed, so intermediates can update 283 it with a pointer to a cached version. 285 3.1.1. Examples 287 The following header is included in the response for an exchange with 288 effective request URI "https://example.com/resource.html". Newlines 289 are added for readability. 291 Signature: 292 sig1; 293 sig=*MEUCIQDXlI2gN3RNBlgFiuRNFpZXcDIaUpX6HIEwcZEc0cZYLAIga9DsVOMM+g5YpwEBdGW3sS+bvnmAJJiSMwhuBdqp5UY=*; 294 integrity="mi"; 295 validity-url="https://example.com/resource.validity.1511128380"; 296 cert-url="https://example.com/oldcerts"; 297 cert-sha256=*W7uB969dFW3Mb5ZefPS9Tq5ZbH5iSmOILpjv2qEArmI=*; 298 date=1511128380; expires=1511733180, 299 sig2; 300 sig=*MEQCIGjZRqTRf9iKNkGFyzRMTFgwf/BrY2ZNIP/dykhUV0aYAiBTXg+8wujoT4n/W+cNgb7pGqQvIUGYZ8u8HZJ5YH26Qg=*; 301 integrity="mi"; 302 validity-url="https://example.com/resource.validity.1511128380"; 303 cert-url="https://example.com/newcerts"; 304 cert-sha256=*J/lEm9kNRODdCmINbvitpvdYKNQ+YgBj99DlYp4fEXw=*; 305 date=1511128380; expires=1511733180, 306 srisig; 307 sig=*lGZVaJJM5f2oGczFlLmBdKTDL+QADza4BgeO494ggACYJOvrof6uh5OJCcwKrk7DK+LBch0jssDYPp5CLc1SDA=* 308 integrity="mi"; 309 validity-url="https://example.com/resource.validity.1511128380"; 310 ed25519key=*zsSevyFsxyZHiUluVBDd4eypdRLTqyWRVOJuuKUz+A8=* 311 date=1511128380; expires=1511733180, 312 thirdpartysig; 313 sig=*MEYCIQCNxJzn6Rh2fNxsobktir8TkiaJYQFhWTuWI1i4PewQaQIhAMs2TVjc4rTshDtXbgQEOwgj2mRXALhfXPztXgPupii+=*; 314 integrity="mi"; 315 validity-url="https://thirdparty.example.com/resource.validity.1511161860"; 316 cert-url="https://thirdparty.example.com/certs"; 317 cert-sha256=*UeOwUPkvxlGRTyvHcsMUN0A2oNsZbU8EUvg8A9ZAnNc=*; 318 date=1511133060; expires=1511478660, 320 There are 4 signatures: 2 from different secp256r1 certificates 321 within "https://example.com/", one using a raw ed25519 public key 322 that's also controlled by "example.com", and a fourth using a 323 secp256r1 certificate owned by "thirdparty.example.com". 325 All 4 signatures rely on the "MI" response header to guard the 326 integrity of the response payload. 328 The signatures include a "validity-url" that includes the first time 329 the resource was seen. This allows multiple versions of a resource 330 at the same URL to be updated with new signatures, which allows 331 clients to avoid transferring extra data while the old versions don't 332 have known security bugs. 334 The certificates at "https://example.com/oldcerts" and 335 "https://example.com/newcerts" have "subjectAltName"s of 336 "example.com", meaning that if they and their signatures validate, 337 the exchange can be trusted as having an origin of 338 "https://example.com/". The publisher might be using two 339 certificates because their readers have disjoint sets of roots in 340 their trust stores. 342 The publisher signed with all three certificates at the same time, so 343 they share a validity range: 7 days starting at 2017-11-19 21:53 UTC. 345 The publisher then requested an additional signature from 346 "thirdparty.example.com", which did some validation or processing and 347 then signed the resource at 2017-11-19 23:11 UTC. 348 "thirdparty.example.com" only grants 4-day signatures, so clients 349 will need to re-validate more often. 351 3.1.2. Open Questions 353 [I-D.ietf-httpbis-header-structure] provides a way to parameterise 354 identifiers but not other supported types like binary content. If 355 the "Signature" header field is notionally a list of parameterised 356 signatures, maybe we should add a "parameterised binary content" 357 type. 359 Should the cert-url and validity-url be lists so that intermediates 360 can offer a cache without losing the original URLs? Putting lists in 361 dictionary fields is more complex than 362 [I-D.ietf-httpbis-header-structure] allows, so they're single items 363 for now. 365 3.2. CBOR representation of exchange headers 367 To sign an exchange's headers, they need to be serialized into a byte 368 string. Since intermediaries and distributors (Appendix A.2) might 369 rearrange, add, or just reserialize headers, we can't use the literal 370 bytes of the headers as this serialization. Instead, this section 371 defines a CBOR representation that can be embedded into other CBOR, 372 canonically serialized (Section 3.4), and then signed. 374 The CBOR representation of an exchange "exchange"'s headers is the 375 CBOR ([RFC7049]) array with the following content: 377 1. The map mapping: 379 * The byte string ':method' to the byte string containing 380 "exchange"'s request's method. 382 * The byte string ':url' to the byte string containing 383 "exchange"'s request's effective request URI, which MUST be an 384 absolute-URL string [6] ([URL]). 386 * For each request header field in "exchange" except for the 387 "Host" header field, the header field's lowercase name as a 388 byte string to the header field's value as a byte string. 390 Note: "Host" is excluded because it is already part of the 391 effective request URI. 393 2. The map mapping: 395 * the byte string ':status' to the byte string containing 396 "exchange"'s response's 3-digit status code, and 398 * for each response header field in "exchange", the header 399 field's lowercase name as a byte string to the header field's 400 value as a byte string. 402 3.2.1. Example 404 Given the HTTP exchange: 406 GET / HTTP/1.1 407 Host: example.com 408 Accept: */* 410 HTTP/1.1 200 411 Content-Type: text/html 412 MI: mi-sha256=20addcf7368837f616d549f035bf6784ea6d4bf4817a3736cd2fc7a763897fe3 413 Signed-Headers: "content-type", "mi" 415 416 417 ... 419 The cbor representation consists of the following item, represented 420 using the extended diagnostic notation from [I-D.ietf-cbor-cddl] 421 appendix G: 423 [ 424 { 425 ':url': 'https://example.com/', 426 'accept': '*/*', 427 ':method': 'GET', 428 }, 429 { 430 'mi': 'mi-sha256=20addcf7368837f616d549f035bf6784ea6d4bf4817a3736cd2fc7a763897fe3', 431 ':status': '200', 432 'content-type': 'text/html' 433 } 434 ] 436 3.3. Loading a certificate chain 438 The resource at a signature's "cert-url" MUST have the "application/ 439 cert-chain+cbor" content type, MUST be canonically-encoded CBOR 440 (Section 3.4), and MUST match the following CDDL: 442 cert-chain = [ 443 "📜⛓", ; U+1F4DC U+26D3 444 + { 445 cert: bytes, 446 ? ocsp: bytes, 447 ? sct: bytes, 448 * tstr => any, 449 } 450 ] 452 The first item in the CBOR array is treated as the end-entity 453 certificate, and the client will attempt to build a path ([RFC5280]) 454 to it from a trusted root using the other certificates in the chain. 456 1. Each "cert" value MUST be a DER-encoded X.509v3 certificate 457 ([RFC5280]). Other key/value pairs in the same array item define 458 properties of this certificate. 460 2. The first certificate's "ocsp" value if any MUST be a complete, 461 DER-encoded OCSP response for that certificate (using the ASN.1 462 type "OCSPResponse" defined in [RFC6960]). Subsequent 463 certificates MUST NOT have an "ocsp" value. 465 3. Each certificate's "sct" value MUST be a 466 "SignedCertificateTimestampList" for that certificate as defined 467 by Section 3.3 of [RFC6962]. 469 Loading a "cert-url" takes a "forceFetch" flag. The client MUST: 471 1. Let "raw-chain" be the result of fetching ([FETCH]) "cert-url". 472 If "forceFetch" is _not_ set, the fetch can be fulfilled from a 473 cache using normal HTTP semantics [RFC7234]. If this fetch 474 fails, return "invalid". 476 2. Let "certificate-chain" be the array of certificates and 477 properties produced by parsing "raw-chain" using the CDDL above. 478 If any of the requirements above aren't satisfied, return 479 "invalid". Note that this validation requirement might be 480 impractical to completely achieve due to certificate validation 481 implementations that don't enforce DER encoding or other standard 482 constraints. 484 3. Return "certificate-chain". 486 3.4. Canonical CBOR serialization 488 Within this specification, the canonical serialization of a CBOR item 489 uses the following rules derived from Section 3.9 of [RFC7049] with 490 erratum 4964 applied: 492 o Integers and the lengths of arrays, maps, and strings MUST use the 493 smallest possible encoding. 495 o Items MUST NOT be encoded with indefinite length. 497 o The keys in every map MUST be sorted in the bytewise lexicographic 498 order of their canonical encodings. For example, the following 499 keys are correctly sorted: 501 1. 10, encoded as 0A. 503 2. 100, encoded as 18 64. 505 3. -1, encoded as 20. 507 4. "z", encoded as 61 7A. 509 5. "aa", encoded as 62 61 61. 511 6. [100], encoded as 81 18 64. 513 7. [-1], encoded as 81 20. 515 8. false, encoded as F4. 517 Note: this specification does not use floating point, tags, or other 518 more complex data types, so it doesn't need rules to canonicalize 519 those. 521 3.5. Signature validity 523 The client MUST parse the "Signature" header field as the 524 parameterised list (Section 4.2.3 of 525 [I-D.ietf-httpbis-header-structure]) described in Section 3.1. If an 526 error is thrown during this parsing or any of the requirements 527 described there aren't satisfied, the exchange has no valid 528 signatures. Otherwise, each member of this list represents a 529 signature with parameters. 531 The client MUST use the following algorithm to determine whether each 532 signature with parameters is invalid or potentially-valid for an 533 "exchange". Potentially-valid results include: 535 o The signed headers of the exchange so that higher-level protocols 536 can avoid relying on unsigned headers, and 538 o Either a certificate chain or a public key so that a higher-level 539 protocol can determine whether it's actually valid. 541 This algorithm accepts a "forceFetch" flag that avoids the cache when 542 fetching URLs. A client that determines that a potentially-valid 543 certificate chain is actually invalid due to an expired OCSP response 544 MAY retry with "forceFetch" set to retrieve an updated OCSP from the 545 original server. 547 1. Let "payload" be the payload body (Section 3.3 of [RFC7230]) of 548 "exchange". Note that the payload body is the message body with 549 any transfer encodings removed. 551 2. Let: 553 * "signature" be the signature (binary content in the 554 parameterised identifier's "sig" parameter). 556 * "integrity" be the signature's "integrity" parameter. 558 * "validity-url" be the signature's "validity-url" parameter. 560 * "cert-url" be the signature's "cert-url" parameter, if any. 562 * "cert-sha256" be the signature's "cert-sha256" parameter, if 563 any. 565 * "ed25519key" be the signature's "ed25519key" parameter, if 566 any. 568 * "date" be the signature's "date" parameter, interpreted as a 569 Unix time. 571 * "expires" be the signature's "expires" parameter, interpreted 572 as a Unix time. 574 3. If "integrity" names a header field that is not present in 575 "exchange"'s response headers or which the client cannot use to 576 check the integrity of "payload" (for example, the header field 577 is new and hasn't been implemented yet), then return "invalid". 578 If the selected header field provides integrity guarantees weaker 579 than SHA-256, return "invalid". If validating integrity using 580 the selected header field requires the client to process records 581 larger than TBD bytes, return "invalid". Clients MUST implement 582 at least the "MI" ([I-D.thomson-http-mice]) header field with its 583 "mi-sha256" content encoding. 585 4. Set "publicKey" and "signing-alg" depending on which key fields 586 are present: 588 1. If "cert-url" is present: 590 1. Let "certificate-chain" be the result of loading the 591 certificate chain at "cert-url" passing the "forceFetch" 592 flag (Section 3.3). If this returns "invalid", return 593 "invalid". 595 2. Let "main-certificate" be the first certificate in 596 "certificate-chain". 598 3. Set "publicKey" to "main-certificate"'s public key. 600 4. If "publicKey" is an RSA key, return "invalid". 602 5. If "publicKey" is a key using the secp256r1 elliptic 603 curve, set "signing-alg" to ecdsa_secp256r1_sha256 as 604 defined in Section 4.2.3 of [I-D.ietf-tls-tls13]. 606 6. Otherwise, either return "invalid" or set "signing-alg" 607 to a non-legacy signing algorithm defined by TLS 1.3 or 608 later ([I-D.ietf-tls-tls13]). This choice MUST depend 609 only on "publicKey"'s type and not on any other context. 611 2. If "ed25519key" is present, set "publicKey" to "ed25519key" 612 and "signing-alg" to ed25519, as defined by [RFC8032] 614 5. If "expires" is more than 7 days (604800 seconds) after "date", 615 return "invalid". 617 6. If the current time is before "date" or after "expires", return 618 "invalid". 620 7. Let "message" be the concatenation of the following byte strings. 621 This matches the [I-D.ietf-tls-tls13] format to avoid cross- 622 protocol attacks if anyone uses the same key in a TLS certificate 623 and an exchange-signing certificate. 625 1. A string that consists of octet 32 (0x20) repeated 64 times. 627 2. A context string: the ASCII encoding of "HTTP Exchange 1". 629 Note: RFC EDITOR PLEASE DELETE THIS NOTE; The implementation 630 of the final RFC MUST use this context string, but 631 implementations of drafts MUST NOT use it and MUST use 632 another draft-specific string beginning with "HTTP Exchange 1 633 " instead. This ensures that signers can predict how their 634 signatures will be used. 636 3. A single 0 byte which serves as a separator. 638 4. The bytes of the canonical CBOR serialization (Section 3.4) 639 of a CBOR map mapping: 641 1. If "cert-sha256" is set: 643 1. The text string "cert-sha256" to the byte string 644 value of "cert-sha256". 646 2. The text string "validity-url" to the byte string value 647 of "validity-url". 649 3. The text string "date" to the integer value of "date". 651 4. The text string "expires" to the integer value of 652 "expires". 654 5. The text string "headers" to the CBOR representation 655 (Section 3.2) of "exchange"'s headers. 657 8. If "cert-url" is present and the SHA-256 hash of "main- 658 certificate"'s "cert_data" is not equal to "cert-sha256" (whose 659 presence was checked when the "Signature" header field was 660 parsed), return "invalid". 662 Note that this intentionally differs from TLS 1.3, which signs 663 the entire certificate chain in its Certificate Verify 664 (Section 4.4.3 of [I-D.ietf-tls-tls13]), in order to allow 665 updating the stapled OCSP response without updating signatures at 666 the same time. 668 9. If "signature" is a valid signature of "message" by "publicKey" 669 using "signing-alg", return "potentially-valid" with whichever is 670 present of "certificate-chain" or "ed25519key". Otherwise, 671 return "invalid". 673 Note that the above algorithm can determine that an exchange's 674 headers are potentially-valid before the exchange's payload is 675 received. Similarly, if "integrity" identifies a header field like 676 "MI" ([I-D.thomson-http-mice]) that can incrementally validate the 677 payload, early parts of the payload can be determined to be 678 potentially-valid before later parts of the payload. Higher-level 679 protocols MAY process parts of the exchange that have been determined 680 to be potentially-valid as soon as that determination is made but 681 MUST NOT process parts of the exchange that are not yet potentially- 682 valid. Similarly, as the higher-level protocol determines that parts 683 of the exchange are actually valid, the client MAY process those 684 parts of the exchange and MUST wait to process other parts of the 685 exchange until they too are determined to be valid. 687 3.5.1. Open Questions 689 Should the signed message use the TLS format (with an initial 64 690 spaces) even though these certificates can't be used in TLS servers? 692 3.6. Updating signature validity 694 Both OCSP responses and signatures are designed to expire a short 695 time after they're signed, so that revoked certificates and signed 696 exchanges with known vulnerabilities are distrusted promptly. 698 This specification provides no way to update OCSP responses by 699 themselves. Instead, clients need to re-fetch the "cert-url" 700 (Section 3.5, Paragraph 4) to get a chain including a newer OCSP 701 response. 703 The "validity-url" parameter (Paragraph 6) of the signatures provides 704 a way to fetch new signatures or learn where to fetch a complete 705 updated exchange. 707 Each version of a signed exchange SHOULD have its own validity URLs, 708 since each version needs different signatures and becomes obsolete at 709 different times. 711 The resource at a "validity-url" is "validity data", a CBOR map 712 matching the following CDDL ([I-D.ietf-cbor-cddl]): 714 validity = { 715 ? signatures: [ + bytes ] 716 ? update: { 717 ? size: uint, 718 } 719 ] 721 The elements of the "signatures" array are parameterised identifiers 722 (Section 4.2.4 of [I-D.ietf-httpbis-header-structure]) meant to 723 replace the signatures within the "Signature" header field pointing 724 to this validity data. If the signed exchange contains a bug severe 725 enough that clients need to stop using the content, the "signatures" 726 array MUST NOT be present. 728 If the the "update" map is present, that indicates that a new version 729 of the signed exchange is available at its effective request URI 730 (Section 5.5 of [RFC7230]) and can give an estimate of the size of 731 the updated exchange ("update.size"). If the signed exchange is 732 currently the most recent version, the "update" SHOULD NOT be 733 present. 735 If both the "signatures" and "update" fields are present, clients can 736 use the estimated size to decide whether to update the whole resource 737 or just its signatures. 739 3.6.1. Examples 741 For example, say a signed exchange whose URL is "https://example.com/ 742 resource" has the following "Signature" header field (with line 743 breaks included and irrelevant fields omitted for ease of reading). 745 Signature: 746 sig1; 747 sig=*MEUCIQ...*; 748 ... 749 validity-url="https://example.com/resource.validity.1511157180"; 750 cert-url="https://example.com/oldcerts"; 751 date=1511128380; expires=1511733180, 752 sig2; 753 sig=*MEQCIG...*; 754 ... 755 validity-url="https://example.com/resource.validity.1511157180"; 756 cert-url="https://example.com/newcerts"; 757 date=1511128380; expires=1511733180, 758 thirdpartysig; 759 sig=*MEYCIQ...*; 760 ... 761 validity-url="https://thirdparty.example.com/resource.validity.1511161860"; 762 cert-url="https://thirdparty.example.com/certs"; 763 date=1511478660; expires=1511824260 765 At 2017-11-27 11:02 UTC, "sig1" and "sig2" have expired, but 766 "thirdpartysig" doesn't exipire until 23:11 that night, so the client 767 needs to fetch "https://example.com/resource.validity.1511157180" 768 (the "validity-url" of "sig1" and "sig2") to update those signatures. 769 This URL might contain: 771 { 772 "signatures": [ 773 'sig1; ' 774 'sig=*MEQCIC/I9Q+7BZFP6cSDsWx43pBAL0ujTbON/+7RwKVk+ba5AiB3FSFLZqpzmDJ0NumNwN04pqgJZE99fcK86UjkPbj4jw==*; ' 775 'validity-url="https://example.com/resource.validity.1511157180"; ' 776 'integrity="mi"; ' 777 'cert-url="https://example.com/newcerts"; ' 778 'cert-sha256=*J/lEm9kNRODdCmINbvitpvdYKNQ+YgBj99DlYp4fEXw=*; ' 779 'date=1511733180; expires=1512337980' 780 ], 781 "update": { 782 "size": 5557452 783 } 784 } 786 This indicates that the client could fetch a newer version at 787 "https://example.com/resource" (the original URL of the exchange), or 788 that the validity period of the old version can be extended by 789 replacing the first two of the original signatures (the ones with a 790 validity-url of "https://example.com/resource.validity.1511157180") 791 with the single new signature provided. (This might happen at the 792 end of a migration to a new root certificate.) The signatures of the 793 updated signed exchange would be: 795 Signature: 796 sig1; 797 sig=*MEQCIC...*; 798 ... 799 validity-url="https://example.com/resource.validity.1511157180"; 800 cert-url="https://example.com/newcerts"; 801 date=1511733180; expires=1512337980, 802 thirdpartysig; 803 sig=*MEYCIQ...*; 804 ... 805 validity-url="https://thirdparty.example.com/resource.validity.1511161860"; 806 cert-url="https://thirdparty.example.com/certs"; 807 date=1511478660; expires=1511824260 809 "https://example.com/resource.validity.1511157180" could also expand 810 the set of signatures if its "signatures" array contained more than 2 811 elements. 813 3.7. The Accept-Signature header 815 "Signature" header fields cost on the order of 300 bytes for ECDSA 816 signatures, so servers might prefer to avoid sending them to clients 817 that don't intend to use them. A client can send the "Accept- 818 Signature" header field to indicate that it does intend to take 819 advantage of any available signatures and to indicate what kinds of 820 signatures it supports. 822 When a server receives an "Accept-Signature" header field in a client 823 request, it SHOULD reply with any available "Signature" header fields 824 for its response that the "Accept-Signature" header field indicates 825 the client supports. However, if the "Accept-Signature" value 826 violates a requirement in this section, the server MUST behave as if 827 it hadn't received any "Accept-Signature" header at all. 829 The "Accept-Signature" header field is a Structured Header as defined 830 by [I-D.ietf-httpbis-header-structure]. Its value MUST be a 831 parameterised list (Section 3.3 of 832 [I-D.ietf-httpbis-header-structure]). Its ABNF is: 834 Accept-Signature = sh-param-list 836 The order of identifiers in the "Accept-Signature" list is not 837 significant. Identifiers, ignoring any initial "-" character, MUST 838 NOT be duplicated. 840 Each identifier in the "Accept-Signature" header field's value 841 indicates that a feature of the "Signature" header field 842 (Section 3.1) is supported. If the identifier begins with a "-" 843 character, it instead indicates that the feature named by the rest of 844 the identifier is not supported. Unknown identifiers and parameters 845 MUST be ignored because new identifiers and new parameters on 846 existing identifiers may be defined by future specifications. 848 3.7.1. Integrity identifiers 850 Identifiers starting with "mi/" indicate that the client supports the 851 "MI" header field ([I-D.thomson-http-mice]) with the parameter from 852 the HTTP MI Parameter Registry registry named in lower-case by the 853 rest of the identifier. For example, "mi/mi-blake2" indicates 854 support for Merkle integrity with the as-yet-unspecified mi-blake2 855 parameter, and "-digest/mi-sha256" indicates non-support for Merkle 856 integrity with the mi-sha256 content encoding. 858 If the "Accept-Signature" header field is present, servers SHOULD 859 assume support for "mi/mi-sha256" unless the header field states 860 otherwise. 862 3.7.2. Key type identifiers 864 Identifiers starting with "ecdsa/" indicate that the client supports 865 certificates holding ECDSA public keys on the curve named in lower- 866 case by the rest of the identifier. 868 If the "Accept-Signature" header field is present, servers SHOULD 869 assume support for "ecdsa/secp256r1" unless the header field states 870 otherwise. 872 3.7.3. Key value identifiers 874 The "ed25519key" identifier has parameters indicating the public keys 875 that will be used to validate the returned signature. Each 876 parameter's name is re-interpreted as binary content (Section 3.9 of 877 [I-D.ietf-httpbis-header-structure]) encoding a prefix of the public 878 key. For example, if the client will validate signatures using the 879 public key whose base64 encoding is 880 "11qYAYKxCrfVS/7TyWQHOg7hcvPapiMlrwIaaPcHURo=", valid "Accept- 881 Signature" header fields include: 883 Accept-Signature: ..., ed25519key; *11qYAYKxCrfVS/7TyWQHOg7hcvPapiMlrwIaaPcHURo=* 884 Accept-Signature: ..., ed25519key; *11qYAYKxCrfVS/7TyWQHOg==* 885 Accept-Signature: ..., ed25519key; *11qYAQ==* 886 Accept-Signature: ..., ed25519key; ** 887 but not 889 Accept-Signature: ..., ed25519key; *11qYA===* 891 because 5 bytes isn't a valid length for encoded base64, and not 893 Accept-Signature: ..., ed25519key; 11qYAQ 895 because it doesn't start or end with the "*"s that indicate binary 896 content. 898 Note that "ed25519key; **" is an empty prefix, which matches all 899 public keys, so it's useful in subresource integrity (Appendix A.3) 900 cases like "" where the public 901 key isn't known until the matching "