idnits 2.17.1 draft-ietf-websec-key-pinning-16.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 is 1 instance of too long lines in the document, the longest one being 1 character 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 (June 25, 2014) is 3565 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Outdated reference: A later version (-10) exists of draft-josefsson-pkix-textual-03 ** Obsolete normative reference: RFC 4627 (Obsoleted by RFC 7158, RFC 7159) ** Obsolete normative reference: RFC 4634 (Obsoleted by RFC 6234) ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) ** Obsolete normative reference: RFC 7230 (Obsoleted by RFC 9110, RFC 9112) ** Obsolete normative reference: RFC 7234 (Obsoleted by RFC 9111) -- Obsolete informational reference (is this intentional?): RFC 5226 (Obsoleted by RFC 8126) Summary: 6 errors (**), 0 flaws (~~), 2 warnings (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Web Security C. Evans 3 Internet-Draft C. Palmer 4 Intended status: Standards Track R. Sleevi 5 Expires: December 27, 2014 Google, Inc. 6 June 25, 2014 8 Public Key Pinning Extension for HTTP 9 draft-ietf-websec-key-pinning-16 11 Abstract 13 This memo describes an extension to the HTTP protocol allowing web 14 host operators to instruct user agents to remember ("pin") the hosts' 15 cryptographic identities for a given period of time. During that 16 time, UAs will require that the host present a certificate chain 17 including at least one Subject Public Key Info structure whose 18 fingerprint matches one of the pinned fingerprints for that host. By 19 effectively reducing the number of authorities who can authenticate 20 the domain during the lifetime of the pin, pinning may reduce the 21 incidence of man-in-the-middle attacks due to compromised 22 Certification Authorities. 24 Status of This Memo 26 This Internet-Draft is submitted in full conformance with the 27 provisions of BCP 78 and BCP 79. 29 Internet-Drafts are working documents of the Internet Engineering 30 Task Force (IETF). Note that other groups may also distribute 31 working documents as Internet-Drafts. The list of current Internet- 32 Drafts is at http://datatracker.ietf.org/drafts/current/. 34 Internet-Drafts are draft documents valid for a maximum of six months 35 and may be updated, replaced, or obsoleted by other documents at any 36 time. It is inappropriate to use Internet-Drafts as reference 37 material or to cite them other than as "work in progress." 39 This Internet-Draft will expire on December 27, 2014. 41 Copyright Notice 43 Copyright (c) 2014 IETF Trust and the persons identified as the 44 document authors. All rights reserved. 46 This document is subject to BCP 78 and the IETF Trust's Legal 47 Provisions Relating to IETF Documents 48 (http://trustee.ietf.org/license-info) in effect on the date of 49 publication of this document. Please review these documents 50 carefully, as they describe your rights and restrictions with respect 51 to this document. Code Components extracted from this document must 52 include Simplified BSD License text as described in Section 4.e of 53 the Trust Legal Provisions and are provided without warranty as 54 described in the Simplified BSD License. 56 Table of Contents 58 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 59 1.1. Requirements Language . . . . . . . . . . . . . . . . . . 3 60 2. Server and Client Behavior . . . . . . . . . . . . . . . . . 3 61 2.1. Response Header Field Syntax . . . . . . . . . . . . . . 3 62 2.1.1. The max-age Directive . . . . . . . . . . . . . . . . 5 63 2.1.2. The includeSubDomains Directive . . . . . . . . . . . 5 64 2.1.3. The report-uri Directive . . . . . . . . . . . . . . 5 65 2.1.4. Examples . . . . . . . . . . . . . . . . . . . . . . 6 66 2.2. Server Processing Model . . . . . . . . . . . . . . . . . 7 67 2.2.1. HTTP-over-Secure-Transport Request Type . . . . . . . 7 68 2.2.2. HTTP Request Type . . . . . . . . . . . . . . . . . . 8 69 2.3. User Agent Processing Model . . . . . . . . . . . . . . . 8 70 2.3.1. Public-Key-Pins Response Header Field Processing . . 8 71 2.3.2. Interaction of Public-Key-Pins and Public-Key-Pins- 72 Report-Only . . . . . . . . . . . . . . . . . . . . . 9 73 2.3.3. Noting a Pinned Host - Storage Model . . . . . . . . 10 74 2.3.4. HTTP-Equiv Element Attribute . . . . . . . . . 11 75 2.4. Semantics of Pins . . . . . . . . . . . . . . . . . . . . 11 76 2.5. Noting Pins . . . . . . . . . . . . . . . . . . . . . . . 12 77 2.6. Validating Pinned Connections . . . . . . . . . . . . . . 13 78 2.7. Interactions With Preloaded Pin Lists . . . . . . . . . . 14 79 2.8. Pinning Self-Signed End Entities . . . . . . . . . . . . 14 80 3. Reporting Pin Validation Failure . . . . . . . . . . . . . . 14 81 4. Security Considerations . . . . . . . . . . . . . . . . . . . 17 82 4.1. Maximum max-age . . . . . . . . . . . . . . . . . . . . . 18 83 4.2. Using includeSubDomains Safely . . . . . . . . . . . . . 18 84 4.3. Backup Pins . . . . . . . . . . . . . . . . . . . . . . . 19 85 4.4. Interactions With Cookie Scoping . . . . . . . . . . . . 20 86 5. Privacy Considerations . . . . . . . . . . . . . . . . . . . 20 87 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 21 88 7. Usability Considerations . . . . . . . . . . . . . . . . . . 22 89 8. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 22 90 9. What's Changed . . . . . . . . . . . . . . . . . . . . . . . 22 91 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 23 92 10.1. Normative References . . . . . . . . . . . . . . . . . . 23 93 10.2. Informative References . . . . . . . . . . . . . . . . . 24 94 Appendix A. Fingerprint Generation . . . . . . . . . . . . . . . 25 95 Appendix B. Deployment Guidance . . . . . . . . . . . . . . . . 25 96 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 26 98 1. Introduction 100 We propose a new HTTP header to enable a web host to express to user 101 agents (UAs) which Subject Public Key Info (SPKI) structure(s) UAs 102 SHOULD expect to be present in the host's certificate chain in future 103 connections using TLS (see [RFC5246]). We call this "public key 104 pinning" (PKP). At least one UA (Google Chrome) has experimented 105 with the idea by shipping with a user-extensible embedded set of 106 Pins. Although effective, this does not scale. This proposal 107 addresses the scale problem. 109 Deploying PKP safely will require operational and organizational 110 maturity due to the risk that hosts may make themselves unavailable 111 by pinning to a (set of) SPKI(s) that becomes invalid. (See 112 Section 4.) We believe that, with care, host operators can greatly 113 reduce the risk of main-in-the-middle (MITM) attacks and other false- 114 authentication problems for their users without incurring undue risk. 116 We intend for hosts to use PKP together with HSTS ([RFC6797]), but is 117 possible to pin keys without requiring HSTS. 119 This draft is being discussed on the WebSec Working Group mailing 120 list, websec@ietf.org. 122 1.1. Requirements Language 124 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 125 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 126 document are to be interpreted as described in RFC 2119 [RFC2119]. 128 2. Server and Client Behavior 130 2.1. Response Header Field Syntax 132 The "Public-Key-Pins" and "Public-Key-Pins-Report-Only" header 133 fields, also referred to within this specification as the PKP and 134 PKP-RO header fields, respectively, are are response headers used by 135 server to indicate that a a UA should perform Pin Validation 136 (Section 2.6) in regards to the host emitting the response message 137 containing these header fields, and provide the necessary information 138 for the UA to do so. 140 Figure 1 describes the syntax (Augmented Backus-Naur Form) of the 141 header fields, using the grammar defined in [RFC5234] and the rules 142 defined in Section 3.2 of [RFC7230]. The field values of both header 143 fields conform to the same rules. 145 Public-Key-Directives = [ directive ] *( OWS ";" OWS [ directive ] ) 147 directive = simple-directive 148 / pin-directive 150 simple-directive = directive-name [ "=" directive-value ] 151 directive-name = token 152 directive-value = token 153 / quoted-string 155 pin-directive = "pin-" token "=" quoted-string 157 Figure 1: HPKP Header Syntax 159 OWS is used as defined in Section 3.2.3 of [RFC7230]. token and 160 quoted-string are used as defined in Section 3.2.6 of [RFC7230]. 162 The directives defined in this specification are described below. 163 The overall requirements for directives are: 165 1. The order of appearance of directives is not significant. 167 2. All simple-directives MUST appear only once in a given header 168 field. Directives are either optional or required, as stipulated 169 in their definitions. 171 3. Directive names are case-insensitive. 173 4. UAs MUST ignore any header fields containing directives, or other 174 header field value data, that do not conform to the syntax 175 defined in this specification. 177 5. If a header field contains any directive(s) the UA does not 178 recognize, the UA MUST ignore those directives. 180 6. If the PKP or PKP-RO header field otherwise satisfies the above 181 requirements (1 through 5), the UA MUST process the directives it 182 recognizes. 184 Additional directives extending the semantic functionality of the 185 header fields can be defined in other specifications, with a registry 186 (having an IANA policy definition of IETF Review [RFC5226]) defined 187 for them at such time. Such future directives will be ignored by UAs 188 implementing only this specification, as well as by generally non- 189 conforming UAs. 191 In the pin-directive, the token is the name of a cryptographic hash 192 algorithm, and MUST be "sha256". (In the future, additional hash 193 algorithms MAY be registered and used.) The quoted-string is a 194 sequence of base 64 digits: the base 64-encoded SPKI Fingerprint 195 ([RFC4648]). See Section 2.4. 197 The UA MUST ignore pin-directives with tokens naming hash algorithms 198 it does not recognize. If the set of remaining effective pin- 199 directives is empty, and if the connection passed Pin Validation with 200 the UA's existing noted pins for the Host (i.e. the Host is a Known 201 Pinned Host), the UA MUST cease to consider the Host as a Known 202 Pinned Host. (I.e. the UA should fail open.) The UA SHOULD indicate 203 to users that the Host is no longer a Known Pinned Host. 205 2.1.1. The max-age Directive 207 The "max-age" directive specifies the number of seconds, after the 208 reception of the PKP header field, during which the UA SHOULD regard 209 the host (from whom the message was received) as a Known Pinned Host. 210 The delta-seconds production is specified in [RFC7234]. 212 The "max-age" directive is REQUIRED to be present within a "Public- 213 Key-Pins" header field, and is OPTIONAL within a "Public-Key-Pins- 214 Report-Only" header field. 216 If present, the max-age directive is REQUIRED to have a directive 217 value, for which the the syntax (after quoted-string unescaping, if 218 necessary) is defined as: 220 max-age-value = delta-seconds 221 delta-seconds = 1*DIGIT 223 Figure 2: max-age Value Syntax 225 delta-seconds is used as defined in [RFC7234], Section 1.2.1. 227 2.1.2. The includeSubDomains Directive 229 The OPTIONAL includeSubDomains directive is a valueless directive 230 which, if present (i.e., it is "asserted"), signals to the UA that 231 the Pinning Policy applies to this Pinned Host as well as any 232 subdomains of the host's domain name. 234 2.1.3. The report-uri Directive 236 The OPTIONAL report-uri directive indicates the URI to which the UA 237 SHOULD report Pin Validation failures (Section 2.6). The UA POSTs 238 the reports to the given URI as described in Section 3. 240 When used in the PKP or PKP-RO headers, the presence of a report-uri 241 directive indicates to the UA that in the event of Pin Validation 242 failure it SHOULD POST a report to the report-uri. If the header is 243 Public-Key-Pins, the UA should do this in addition to terminating the 244 connection (as described in Section 2.6). 246 Hosts may set report-uris that use HTTP, HTTPS, or other schemes. If 247 the scheme in the report-uri is one that uses TLS (e.g. HTTPS or 248 WSS), UAs MUST perform Pinning Validation when the host in the 249 report-uri is a Known Pinned Host; similarly, UAs MUST apply HSTS if 250 the host in the report-uri is a Known HSTS Host. 252 Note that the report-uri need not necessarily be in the same Internet 253 domain or web origin as the Known Pinned Host. 255 UAs SHOULD make their best effort to report Pin Validation failures 256 to the report-uri, but may fail to report in exceptional conditions. 257 For example, if connecting the report-uri itself incurs a Pinning 258 Validation failure or other certificate validation failure, the UA 259 MUST cancel the connection. Similarly, if Known Pinned Host A sets a 260 report-uri referring to Known Pinned Host B, and if B sets a report- 261 uri referring to A, and if both hosts fail Pin Validation, the UA 262 SHOULD detect and break the loop by failing to send reports to and 263 about those hosts. 265 In any case of report failure, the UA MAY attempt to re-send the 266 report later. 268 UAs SHOULD limit the rate at which they send reports. For example, 269 it is unnecessary to send the same report to the same report-uri more 270 than once per distinct set of declared pins. 272 2.1.4. Examples 274 Figure 3 shows some example response header fields using the Pins 275 extension. (Lines are folded to fit.) 276 Public-Key-Pins: max-age=3000; 277 pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM="; 278 pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; 280 Public-Key-Pins: max-age=2592000; 281 pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; 282 pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ=" 284 Public-Key-Pins: max-age=2592000; 285 pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; 286 pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; 287 report-uri="http://example.com/pkp-report" 289 Public-Key-Pins-Report-Only: max-age=2592000; 290 pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; 291 pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; 292 report-uri="https://other.example.net/pkp-report" 294 Public-Key-Pins: 295 pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM="; 296 pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; 297 max-age=259200 299 Public-Key-Pins: 300 pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM="; 301 pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; 302 pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; 303 max-age=10000; includeSubDomains 305 Figure 3: HPKP Header Examples 307 2.2. Server Processing Model 309 This section describes the processing model that Pinned Hosts 310 implement. The model has 2 parts: (1) the processing rules for HTTP 311 request messages received over a secure transport (e.g. TLS); and 312 (2) the processing rules for HTTP request messages received over non- 313 secure transports, such as TCP. 315 2.2.1. HTTP-over-Secure-Transport Request Type 317 When replying to an HTTP request that was conveyed over a secure 318 transport, a Pinned Host SHOULD include in its response exactly one 319 PKP header field, exactly one PKP-RO header field, or one of each. 320 Each instance of either header field MUST satisfy the grammar 321 specified in Section 2.1. 323 Establishing a given host as a Known Pinned Host, in the context of a 324 given UA, MAY be accomplished over the HTTP protocol, which is in 325 turn running over secure transport, by correctly returning (per this 326 specification) at least one valid PKP header field to the UA. Other 327 mechanisms, such as a client-side pre-loaded Known Pinned Host list 328 MAY also be used. 330 2.2.2. HTTP Request Type 332 Pinned Hosts SHOULD NOT include the PKP header field in HTTP 333 responses conveyed over non-secure transport. UAs MUST ignore any 334 PKP header received in an HTTP response conveyed over non-secure 335 transport. 337 2.3. User Agent Processing Model 339 The UA processing model relies on parsing domain names. Note that 340 internationalized domain names SHALL be canonicalized according to 341 the scheme in Section 10 of [RFC6797]. 343 2.3.1. Public-Key-Pins Response Header Field Processing 345 If the UA receives, over a secure transport, an HTTP response that 346 includes a PKP header field conforming to the grammar specified in 347 Section 2.1, and there are no underlying secure transport errors or 348 warnings (see Section 2.5), the UA MUST either: 350 o Note the host as a Known Pinned Host if it is not already so noted 351 (see Section 2.3.3), 353 or, 355 o Update the UA's cached information for the Known Pinned Host if 356 any of of the max-age, includeSubDomains, or report-uri header 357 field value directives convey information different than that 358 already maintained by the UA. 360 o The max-age value is essentially a "time to live" value relative 361 to the time of the most recent observation of the PKP header 362 field. 364 o If the max-age header field value token has a value of 0, the UA 365 MUST remove its cached Pinning Policy information (including the 366 includeSubDomains directive, if asserted) if the Pinned Host is 367 Known, or, MUST NOT note this Pinned Host if it is not yet Known. 369 o If a UA receives more than one PKP header field or more than one 370 PKP-RO header fieled in an HTTP response message over secure 371 transport, then the UA MUST process only the first PKP header 372 field (if present) and only the first PKP-RO header field (if 373 present). 375 Otherwise: 377 o If the UA receives the HTTP response over insecure transport, or 378 if the PKP header is not a Valid Pinning Header (see Section 2.5), 379 the UA MUST ignore any present PKP header field(s). 381 o Similarly, if the UA receives the HTTP response over insecure 382 transport, the UA MUST ignore any present PKP-RO header field(s). 384 o The UA MUST ignore any PKP or PKP-RO header fields not conforming 385 to the grammar specified in Section 2.1. 387 2.3.2. Interaction of Public-Key-Pins and Public-Key-Pins-Report-Only 389 A server MAY set both the "Public-Key-Pins" and "Public-Key-Pins- 390 Report-Only" headers simultaneously. The headers do not interact 391 with one another but the UA MUST process the PKP header and SHOULD 392 process both. 394 The headers are processed according to Section 2.3.1. 396 When the PKP-RO header is used with a report-uri, the UA SHOULD POST 397 reports for Pin Validation failures to the indicated report-uri, 398 although the UA MUST NOT enforce Pin Validation. That is, in the 399 event of Pin Validation failure when the host has set the PKP-RO 400 header, the UA performs Pin Validation only to check whether or not 401 it should POST a report, but not for causing connection failure. 403 Note: There is no purpose to using the PKP-RO header without the 404 report-uri directive. User Agents MAY discard such headers without 405 interpreting them further. 407 When the PKP header is used with a report-uri, the UA SHOULD POST 408 reports for Pin Validation failures to the indicated report-uri, as 409 well as enforcing Pin Validation. 411 If a Host sets the PKP-RO header, the UA SHOULD note the Pins and 412 directives given in the PKP-RO header as specified by the max-age 413 directive. If the UA does note the Pins and directives in the PKP-RO 414 header it SHOULD evaluate the specified policy and SHOULD report any 415 would-be Pin Validation failures that would occur if the report-only 416 policy were enforced. 418 If a Host sets both the PKP header and the PKP-RO header, the UA MUST 419 note and enforce Pin Validation as specified by the PKP header, and 420 SHOULD process the Pins and directives given in the PKP-RO header. 421 If the UA does process the Pins and directives in the PKP-RO header 422 it SHOULD evaluate the specified policy and SHOULD report any would- 423 be Pin Validation failures that would occur if the report-only policy 424 were enforced. 426 2.3.3. Noting a Pinned Host - Storage Model 428 The Effective Pin Date of a Known Pinned Host is the time that the UA 429 observed a Valid Pinning Header for the host. The Effective 430 Expiration Date of a Known Pinned Host is the Effective Pin Date plus 431 the max-age. A Known Pinned Host is "expired" if the Effective 432 Expiration Date refers to a date in the past. The UA MUST ignore all 433 expired Known Pinned Hosts from its cache if, at any time, an expired 434 Known Pinned Host exists in the cache. 436 If the substring matching the host production from the Request-URI 437 (of the message to which the host responded) syntactically matches 438 the IP-literal or IPv4address productions from Section 3.2.2 of 439 [RFC3986], then the UA MUST NOT note this host as a Known Pinned 440 Host. 442 Otherwise, if the substring does not congruently match a Known Pinned 443 Host's domain name, per the matching procedure specified in 444 Section 8.2 of [RFC6797], then the UA MUST note this host as a Known 445 Pinned Host, caching the Pinned Host's domain name and noting along 446 with it the Effective Expiration Date (or enough information to 447 calculate it, i.e. the Effective Pin Date and the value of the max- 448 age directive), whether or not the includeSubDomains directive is 449 asserted, the value of the report-uri directive (if present). If any 450 other metadata from optional or future PKP header directives is 451 present in the Valid Pinning Header, the UA MAY note them if it 452 understands them, and need not note them if it does not understand 453 them. 455 UAs MAY set an upper limit on the value of max-age, so that UAs that 456 have noted erroneous Pins (whether by accident or due to attack) have 457 some chance of recovering over time. If the server sets a max-age 458 greater than the UA's upper limit, the UA MAY behave as if the server 459 set the max-age to the UA's upper limit. For example, if the UA caps 460 max-age at 5184000 seconds (60 days), and a Pinned Host sets a max- 461 age directive of 90 days in its Valid Pinning Header, the UA MAY 462 behave as if the max-age were effectively 60 days. (One way to 463 achieve this behavior is for the UA to simply store a value of 60 464 days instead of the 90 day value provided by the Pinned Host.) For 465 UA implementation guidance on how to select a maximum max-age, see 466 Section 4.1. 468 The UA MUST NOT modify any pinning metadata of any superdomain 469 matched Known Pinned Host. 471 2.3.4. HTTP-Equiv Element Attribute 473 UAs MUST NOT heed http-equiv="Public-Key-Pins" or http-equiv="Public- 474 Key-Pins-Report-Only" attribute settings on elements 475 [W3C.REC-html401-19991224] in received content. 477 2.4. Semantics of Pins 479 An SPKI Fingerprint is defined as the output of a known cryptographic 480 hash algorithm whose input is the DER-encoded ASN.1 representation of 481 the subjectPublicKeyInfo (SPKI) field of an X.509 certificate. A Pin 482 is defined as the combination of the known algorithm identifier and 483 the SPKI Fingerprint computed using that algorithm. 485 The SPKI Fingerprint is encoded in base 64 for use in an HTTP header. 486 (See [RFC4648].) 488 In this version of the specification, the known cryptographic hash 489 algorithm is SHA-256, identified as "sha256" ([RFC4634]). (Future 490 versions of this specification may add new algorithms and deprecate 491 old ones.) UAs MUST ignore Pins for which they do not recognize the 492 algorithm identifier. UAs MUST continue to process the rest of a PKP 493 response header field and note Pins for algorithms they do recognize; 494 UAs MUST recognize "sha256". 496 Figure 4 reproduces the definition of the SubjectPublicKeyInfo 497 structure in [RFC5280]. 499 SubjectPublicKeyInfo ::= SEQUENCE { 500 algorithm AlgorithmIdentifier, 501 subjectPublicKey BIT STRING } 503 AlgorithmIdentifier ::= SEQUENCE { 504 algorithm OBJECT IDENTIFIER, 505 parameters ANY DEFINED BY algorithm OPTIONAL } 507 Figure 4: SPKI Definition 509 If the certificate's subjectPublicKeyInfo is incomplete when taken in 510 isolation, such as when holding a DSA key without domain parameters, 511 a public key pin cannot be formed. Hence, pins using these keys 512 cannot be pinned. 514 We pin public keys, rather than entire certificates, to enable 515 operators to generate new certificates containing old public keys 516 (see [why-pin-key]). 518 See Appendix A for an example non-normative program that generates 519 SPKI Fingerprints from certificates. 521 2.5. Noting Pins 523 Upon receipt of the PKP response header field, the UA notes the host 524 as a Pinned Host, storing the Pins and their associated directives in 525 non-volatile storage (for example, along with the HSTS metadata). 526 The Pins and their associated directives are collectively known as 527 Pinning Metadata. 529 The UA MUST observe these conditions when noting a Host: 531 o The UA MUST note the Pins if and only if it received the PKP 532 response header field over an error-free TLS connection. If the 533 host is a Pinned Host, this includes the validation added in 534 Section 2.6. 536 o The UA MUST note the Pins if and only if the TLS connection was 537 authenticated with a certificate chain containing at least one of 538 the SPKI structures indicated by at least one of the given SPKI 539 Fingerprints. (See Section 2.6.) 541 o The UA MUST note the Pins if and only if the given set of Pins 542 contains at least one Pin that does NOT refer to an SPKI in the 543 certificate chain. (That is, the host must set a Backup Pin; see 544 Section 4.3.) 546 If the PKP response header field does not meet all three of these 547 criteria, the UA MUST NOT note the host as a Pinned Host. A PKP 548 response header field that meets all these critera is known as a 549 Valid Pinning Header. 551 Whenever a UA receives a Valid Pinning Header, it MUST set its 552 Pinning Metadata to the exact Pins, Effective Expiration Date 553 (computed from max-age), and (if any) report-uri given in the most 554 recently received Valid Pinning Header. 556 For forward compatibility, the UA MUST ignore any unrecognized PKP 557 and PKP-RO header directives, while still processing those directives 558 it does recognize. Section 2.1 specifies the directives max-age, 559 Pins, includeSubDomains, and report-uri but future specifications and 560 implementations might use additional directives. 562 Upon receipt of a PKP-RO response header field, the UA SHOULD 563 evaluate the policy expressed in the field, and SHOULD generate and 564 send a report (see Section 3). However, failure to validate the pins 565 in the field MUST have no effect on the validity or non-validity of 566 the policy expressed in the PKP field or in previously-noted pins for 567 the Known Pinned Host. 569 The UA need not note any pins or other policy expressed in the PKP-RO 570 response header field, except for the purpose of determining that it 571 has already sent a report for a given policy. UAs SHOULD make a best 572 effort not to inundate report-uris with redundant reports. 574 2.6. Validating Pinned Connections 576 When a UA connects to a Pinned Host, if the TLS connection has 577 errors, the UA MUST terminate the connection without allowing the 578 user to proceed anyway. (This behavior is the same as that required 579 by [RFC6797].) 581 If the connection has no errors, then the UA will determine whether 582 to apply a new, additional correctness check: Pin Validation. A UA 583 SHOULD perform Pin Validation whenever connecting to a Known Pinned 584 Host, but MAY allow Pin Validation to be disabled for Hosts according 585 to local policy. For example, a UA may disable Pin Validation for 586 Pinned Hosts whose validated certificate chain terminates at a user- 587 defined trust anchor, rather than a trust anchor built-in to the UA. 589 To perform Pin Validation, the UA will compute the SPKI Fingerprints 590 for each certificate in the Pinned Host's validated certificate 591 chain, using each supported hash algorithm for each certificate. (As 592 described in Section 2.4, certificates whose SPKI cannot be taken in 593 isolation cannot be pinned.) The UA MUST ignore superfluous 594 certificates in the chain that do not form part of the validating 595 chain. The UA will then check that the set of these SPKI 596 Fingerprints intersects the set of SPKI Fingerprints in that Pinned 597 Host's Pinning Metadata. If there is set intersection, the UA 598 continues with the connection as normal. Otherwise, the UA MUST 599 treat this Pin Validation Failure as a non-recoverable error. Any 600 procedure that matches the results of this Pin Validation procedure 601 is considered equivalent. 603 Although the UA has previously received Pins at the HTTP layer, it 604 can and MUST perform Pin Validation at the TLS layer, before 605 beginning an HTTP conversation over the TLS channel. The TLS layer 606 thus evaluates TLS connections with pinning information the UA 607 received previously, regardless of mechanism: statically preloaded, 608 via HTTP header, or some other means (possibly in the TLS layer 609 itself). 611 If Pin Validation is not in effect (e.g. because the user has elected 612 to disable it, or because a presented certificate chain chains up to 613 a locally-installed anchor), and if the server has set a report-uri 614 in a PKP or PKP-RO header, the UA SHOULD NOT send any reports to the 615 report-uri for the given certificate chain. 617 2.7. Interactions With Preloaded Pin Lists 619 UAs MAY choose to implement additional sources of pinning 620 information, such as through built-in lists of pinning information. 621 Such UAs SHOULD allow users to override such additional sources, 622 including disabling them from consideration. 624 The effective policy for a Known Pinned Host that has both built-in 625 pins and pins from previously observed PKP header response fields is 626 implementation-defined. 628 2.8. Pinning Self-Signed End Entities 630 If UAs accept hosts that authenticate themselves with self-signed end 631 entity certificates, they MAY also allow hosts to pin the public keys 632 in such certificates. The usability and security implications of 633 this practice are outside the scope of this specification. 635 3. Reporting Pin Validation Failure 637 When a Known Pinned Host has set the report-uri directive, the UA 638 SHOULD report Pin Validation failures to the indicated URI. The UA 639 does this by POSTing a JSON ([RFC4627]) message to the URI; the JSON 640 message takes this form: 642 { 643 "date-time": date-time, 644 "hostname": hostname, 645 "port": port, 646 "effective-expiration-date": expiration-date, 647 "include-subdomains": include-subdomains, 648 "served-certificate-chain": [ 649 pem1, ... pemN 650 ], 651 "validated-certificate-chain": [ 652 pem1, ... pemN 653 ], 654 "known-pins": [ 655 known-pin1, ... known-pinN 656 ] 657 } 659 Figure 5: JSON Report Format 661 Whitespace outside of quoted strings is not significant. The key/ 662 value pairs may appear in any order, but each MUST appear only once. 664 The date-time indicates the time the UA observed the Pin Validation 665 failure. It is provided as a string formatted according to 666 Section 5.6, "Internet Date/Time Format", of [RFC3339]. 668 The hostname is the hostname to which the UA made the original 669 request that failed Pin Validation. It is provided as a string. 671 The port is the port to which the UA made the original request that 672 failed Pin Validation. It is provided as an integer. 674 The effective-expiration-date is the Effective Expiration Date for 675 the noted Pins. It is provided as a string formatted according to 676 Section 5.6, "Internet Date/Time Format", of [RFC3339]. 678 include-subdomains indicates whether or not the UA has noted the 679 includeSubDomains directive for the Known Pinned Host. It is 680 provided as one of the JSON identifiers true or false. 682 The served-certificate-chain is the certificate chain, as served by 683 the Known Pinned Host during TLS session setup. It is provided as an 684 array of strings; each string pem1, ... pemN is the PEM 685 representation of each X.509 certificate as described in 686 [I-D.josefsson-pkix-textual]. 688 The validated-certificate-chain is the certificate chain, as 689 constructed by the UA during certificate chain verification. (This 690 may differ from the served-certificate-chain.) It is provided as an 691 array of strings; each string pem1, ... pemN is the PEM 692 representation of each X.509 certificate as described in 693 [I-D.josefsson-pkix-textual]. For UAs that build certificate chains 694 in more than one way during the validation process, they SHOULD send 695 the last chain built. In this way they can avoid keeping too much 696 state during the validation process. 698 The known-pins are the Pins that the UA has noted for the Known 699 Pinned Host. They are provided as an array of strings with the 700 syntax: 702 known-pin = token "=" quoted-string 704 Figure 6: Known Pin Syntax 706 As in Section 2.4, the token refers to the algorithm name, and the 707 quoted-string refers to the base 64 encoding of the SPKI Fingerprint. 708 When formulating the JSON POST body, the UA MUST either use single- 709 quoted JSON strings, or use double-quoted JSON strings and \-escape 710 the embedded double quotes in the quoted-string part of the known- 711 pin. 713 Figure 7 shows an example of a Pin Validation failure report. (PEM 714 strings are shown on multiple lines for readability.) 716 { 717 "date-time": "2014-04-06T13:00:50Z", 718 "hostname": "www.example.com", 719 "port": 443, 720 "effective-expiration-date": "2014-05-01T12:40:50Z" 721 "include-subdomains": false, 722 "served-certificate-chain": [ 723 "-----BEGIN CERTIFICATE-----\n 724 MIIEBDCCAuygAwIBAgIDAjppMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT\n 725 ... 726 HFa9llF7b1cq26KqltyMdMKVvvBulRP/F/A8rLIQjcxz++iPAsbw+zOzlTvjwsto\n 727 WHPbqCRiOwY1nQ2pM714A5AuTHhdUDqB1O6gyHA43LL5Z/qHQF1hwFGPa4NrzQU6\n 728 yuGnBXj8ytqU0CwIPX4WecigUCAkVDNx\n 729 -----END CERTIFICATE-----", 730 ... 731 ], 732 "validated-certificate-chain": [ 733 "-----BEGIN CERTIFICATE-----\n 734 MIIEBDCCAuygAwIBAgIDAjppMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT\n 735 ... 736 HFa9llF7b1cq26KqltyMdMKVvvBulRP/F/A8rLIQjcxz++iPAsbw+zOzlTvjwsto\n 737 WHPbqCRiOwY1nQ2pM714A5AuTHhdUDqB1O6gyHA43LL5Z/qHQF1hwFGPa4NrzQU6\n 738 yuGnBXj8ytqU0CwIPX4WecigUCAkVDNx\n 739 -----END CERTIFICATE-----", 740 ... 741 ], 742 "known-pins": [ 743 'pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM="', 744 "pin-sha256=\"E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=\"" 745 ] 746 } 748 Figure 7: Pin Validation Failure Report Example 750 4. Security Considerations 752 Pinning public keys helps hosts strongly assert their cryptographic 753 identity even in the face of issuer error, malfeasance or compromise. 754 But there is some risk that a host operator could lose or lose 755 control of their host's private key (such as by operator error or 756 host compromise). If the operator had pinned only the key of the 757 host's end entity certificate, the operator would not be able to 758 serve their web site or application in a way that UAs would trust for 759 the duration of their pin's max-age. (Recall that UAs MUST close the 760 connection to a host upon Pin Failure.) 762 Therefore, there is a necessary trade-off between two competing 763 goods: pin specificity and maximal reduction of the scope of issuers 764 on the one hand; and flexibility and resilience of the host's 765 cryptographic identity on the other hand. One way to resolve this 766 trade-off is to compromise by pinning to the key(s) of the issuer(s) 767 of the host's end entity certificate(s). Often, a valid certificate 768 chain will have at least two certificates above the end entity 769 certificate: the intermediate issuer, and the trust anchor. 770 Operators can pin any one or more of the public keys in this chain, 771 and indeed could pin to issuers not in the chain (as, for example, a 772 Backup Pin). Pinning to an intermediate issuer, or even to a trust 773 anchor or root, still significantly reduces the number of issuers who 774 can issue end entity certificates for the Known Pinned Host, while 775 still giving that host flexibility to change keys without a 776 disruption of service. 778 4.1. Maximum max-age 780 As mentioned in Section 2.3.3, UAs MAY cap the max-age value at some 781 upper limit. There is a security trade-off in that low maximum 782 values provide a narrow window of protection for users who visit the 783 Known Pinned Host only infrequently, while high maximum values might 784 potentially result in a UA's inability to successfully perform Pin 785 Validation for a Known Pinned Host if the UA's noted Pins and the 786 Host's true Pins diverge. 788 Such divergence could occur for several reasons, including: UA error; 789 Host operator error; network attack; or a Known Pinned Host that 790 intentionally migrates all pinned keys, combined with a UA that has 791 noted true Pins with a high max-age value and has not had a chance to 792 observe the new true Pins for the Host. (This last example 793 underscores the importance for Host operators to phase in new keys 794 gradually, and to set the max-age value in accordance with their 795 planned key migration schedule.) 797 There is probably no ideal upper limit to the max-age directive that 798 would satisfy all use cases. However, a value on the order of 60 799 days (5,184,000 seconds) may be considered a balance between the two 800 competing security concerns. 802 4.2. Using includeSubDomains Safely 804 It may happen that Pinned Hosts whose hostnames share a parent domain 805 use different Valid Pinning Headers. If a Host whose hostname is a 806 parent domain for another Host sets the includeSubDomains directive, 807 the two Hosts' Pins may conflict with each other. For example, 808 consider two Known Pinned Hosts, example.com and 809 subdomain.example.com. Assume example.com sets a Valid Pinning 810 Header such as this: 812 Public-Key-Pins: max-age=12000; pin-sha256="ABC..."; pin-sha256="DEF..."; 813 includeSubDomains 815 Figure 8: example.com Valid Pinning Header 817 Assume subdomain.example.com sets a Valid Pinning Header such as 818 this: 820 Public-Key-Pins: pin-sha256="GHI..."; pin-sha256="JKL..." 822 Figure 9: subdomain.example.com Valid Pinning Header 824 Assume a UA that has not previously noted any Pins for either of 825 these Hosts. If the UA first contacts subdomain.example.com, it will 826 note the Pins in the Valid Pinning Header, and perform Pin Validation 827 as normal on subsequent conections. If the UA then contacts 828 example.com, again it will note the Pins and perform Pin Validation 829 on future connections. 831 However, if the UA happened to visit example.com before 832 subdomain.example.com, the UA would, due to example.com's use of the 833 includeSubDomains directive, attempt to perform Pin Validation for 834 subdomain.example.com using the SPKI hashes ABC... and DEF..., which 835 are not valid for the certificate chains subdomain.example.com (which 836 uses certificates with SPKIs GHI... and JLK...). Thus, depending on 837 the order in which the UA observes the Valid Pinning Headers for 838 hosts example.com and subdomain.example.com, Pin Validation might or 839 might not fail for subdomain.example.com, even if the certificate 840 chain the UA receives for subdomain.example.com is perfectly valid. 842 Thus, Pinned Host operators must use the includeSubDomains directive 843 with care. For example, they may choose to use overlapping pin sets 844 for hosts under a parent domain that uses includeSubDomains, or to 845 not use the includeSubDomains directive in their effective-second- 846 level domains, or to simply use the same pin set for all hosts under 847 a given parent domain. 849 4.3. Backup Pins 851 The primary way to cope with the risk of inadvertent Pin Validation 852 Failure is to keep a Backup Pin. A Backup Pin is a fingerprint for 853 the public key of a secondary, not-yet-deployed key pair. The 854 operator keeps the backup key pair offline, and sets a pin for it in 855 the PKP header. Then, in case the operator loses control of their 856 primary private key, they can deploy the backup key pair. UAs, who 857 have had the backup key pair pinned (when it was set in previous 858 Valid Pinning Headers), can connect to the host without error. 860 Because having a backup key pair is so important to recovery, UAs 861 MUST require that hosts set a Backup Pin. (See Section 2.5.) 863 4.4. Interactions With Cookie Scoping 865 HTTP cookies [RFC6265] set by a Known Pinned Host can be stolen by a 866 network attacker who can forge web and DNS responses so as to cause a 867 client to send the cookies to a phony subdomain of the Host. To 868 prevent this, Hosts SHOULD set the "secure" attribute and omit the 869 "domain" attribute on all security-sensitive cookies, such as session 870 cookies. These settings tell the browser that the cookie should only 871 be sent back to the originating host (not its subdomains), and should 872 only be sent over HTTPS (not HTTP). 874 5. Privacy Considerations 876 Hosts can use HSTS or HPKP as a "super-cookie", by setting distinct 877 policies for a number of subdomains. For example, assume example.com 878 wishes to track distinct UAs without explicitly setting a cookie, or 879 if a previously-set cookie is deleted from the UA's cookie store. 880 Here are two attack scenarios. 882 o example.com can use report-uri and the ability to pin arbitrary 883 identifiers to distinguish UAs. 885 1. example.com sets a Valid Pinning Header in its response to 886 requests. The header asserts the includeSubDomains directive, 887 and specifies a report-uri directive as well. Pages served by 888 the host also include references to subresource 889 https://bad.example.com/foo.png. 891 2. The Valid Pinning Header includes a "pin" that is not really 892 the hash of an SPKI, but is instead an arbitrary 893 distinguishing string sent only in response to a particular 894 request. For each request, the Host creates a new, distinct 895 distinguishing string and sets it as if it were a pin. 897 3. The certificate chain served by bad.example.com does not pass 898 Pin Validation given the pin set the Host asserted in (1). 899 The HPKP-conforming UA attempts to report the Pin Validation 900 failure to the specified report-uri, including the certificate 901 chain it observed and the SPKI hashes it expected to see. 902 Among the SPKI hashes is the distinguishing string in step 903 (2). 905 4. Different site operators/origins can optionally collaborate by 906 setting the report-uri to be in an origin they share 907 administrative control of. UAs MAY, therefore, refuse to send 908 reports outside of the origin that set the PKP or PKP-RO 909 header. 911 o example.com can use SNI and subdomains to distinguish UAs. 913 1. example.com sets a Valid Pinning Header in its response to 914 requests. The header asserts the includeSubDomains directive. 916 2. On a subsequent page view, the Host responds with a page 917 including the subresource https://0.fingerprint.example.com/ 918 foo.png, and the server responds using a certificate chain 919 that does not pass Pin Validation for the pin-set defined in 920 the Valid Pinning Header in step (1). The HPKP-conforming UA 921 will close the connection, never completing the request to 922 0.fingerprint.example.com. The Host may thus note that this 923 particular UA had noted the (good) Pins for that subdomain. 925 3. example.com can distinguish 2^N UAs by serving Valid Pinning 926 Headers from an arbitrary number N distinct subdomains, giving 927 some UAs Valid Pinning Headers for some, but not all 928 subdomains (causing subsequent requests for 929 n.fingerprint.example.com to fail), and giving some UAs no 930 Valid Pinning Header for other subdomains (causing subsequent 931 requests for m.fingerprint.example.com to succeed). 933 Conforming implementations (as well as implementations conforming to 934 [RFC6797]) must store state about which domains have set policies, 935 hence which domains the UA has contacted. A forensic attacker might 936 find this information useful, even if the user has cleared other 937 parts of the UA's state. 939 6. IANA Considerations 941 IANA is requested to register the header described in this document 942 in the "Message Headers" registry, with the following parameters: 944 o Header Field Names should be "Public-Key-Pins" and "Public-Key- 945 Pins-Report-Only". 947 o Protocol should be "http" 949 o Status should be "standard" 951 o Reference should be this document 953 7. Usability Considerations 955 When pinning works to detect impostor Pinned Hosts, users will 956 experience denial of service. UAs MUST explain the reason why, i.e. 957 that it was impossible to verify the confirmed cryptographic identity 958 of the host. 960 UAs MUST have a way for users to clear current Pins for Pinned Hosts. 961 UAs SHOULD have a way for users to query the current state of Pinned 962 Hosts. 964 8. Acknowledgements 966 Thanks to Tobias Gondrom, Jeff Hodges, Paul Hoffman, Ivan Krstic, 967 Adam Langley, Nicolas Lidzborski, SM, James Manger, Yoav Nir, Trevor 968 Perrin, Eric Rescorla, Tom Ritter, and Yan Zhu for suggestions and 969 edits that clarified the text. 971 9. What's Changed 973 [RFC EDITOR: PLEASE REMOVE THIS SECTION] 975 Clarified that max-age is REQUIRED for PKP, but OPTIONAL for PKP-RO 976 (where it has no effect. 978 Updated header field syntax and description to match that in 979 [RFC7230]. 981 Updated normative references to current documents. 983 Removed the strict directive. 985 Removed the requirement that the server set the Valid Pinning Header 986 on every response. 988 Added normative references for SHA, JSON, and base-64. 990 Added the Privacy Considerations section. 992 Changed non-normative pin generation code from Go to POSIX shell 993 script using openssl. 995 Changed max-max-age from SHOULD to MAY, and used the example of 60 996 days instead of 30. 998 Removed the section "Pin Validity Times", which was intended to be in 999 harmony with [I-D.perrin-tls-tack]. Now using max-age purely as 1000 specified in [RFC6797]. 1002 Added new directives: includeSubDomains, report-uri and strict. 1004 Added a new variant of the PKP Header: Public-Key-Pins-Report-Only. 1006 Removed the section on pin break codes and verifiers, in favor the of 1007 most-recently-received policy (Section 2.5). 1009 Now using a new header field, Public-Key-Pins, separate from HSTS. 1010 This allows hosts to use pinning separately from Strict Transport 1011 Security. 1013 Explicitly requiring that UAs perform Pin Validation before the HTTP 1014 conversation begins. 1016 Backup Pins are now required. 1018 Separated normative from non-normative material. Removed tangential 1019 and out-of-scope non-normative discussion. 1021 10. References 1023 10.1. Normative References 1025 [I-D.josefsson-pkix-textual] 1026 Josefsson, S. and S. Leonard, "Text Encodings of PKIX and 1027 CMS Structures", draft-josefsson-pkix-textual-03 (work in 1028 progress), April 2014. 1030 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1031 Requirement Levels", BCP 14, RFC 2119, March 1997. 1033 [RFC3339] Klyne, G., Ed. and C. Newman, "Date and Time on the 1034 Internet: Timestamps", RFC 3339, July 2002. 1036 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 1037 Resource Identifier (URI): Generic Syntax", STD 66, RFC 1038 3986, January 2005. 1040 [RFC4627] Crockford, D., "The application/json Media Type for 1041 JavaScript Object Notation (JSON)", RFC 4627, July 2006. 1043 [RFC4634] Eastlake, D. and T. Hansen, "US Secure Hash Algorithms 1044 (SHA and HMAC-SHA)", RFC 4634, July 2006. 1046 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 1047 Encodings", RFC 4648, October 2006. 1049 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 1050 Specifications: ABNF", STD 68, RFC 5234, January 2008. 1052 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 1053 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 1055 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 1056 Housley, R., and W. Polk, "Internet X.509 Public Key 1057 Infrastructure Certificate and Certificate Revocation List 1058 (CRL) Profile", RFC 5280, May 2008. 1060 [RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265, 1061 April 2011. 1063 [RFC6797] Hodges, J., Jackson, C., and A. Barth, "HTTP Strict 1064 Transport Security (HSTS)", RFC 6797, November 2012. 1066 [RFC7230] Fielding, R. and J. Reschke, "Hypertext Transfer Protocol 1067 (HTTP/1.1): Message Syntax and Routing", RFC 7230, June 1068 2014. 1070 [RFC7234] Fielding, R., Nottingham, M., and J. Reschke, "Hypertext 1071 Transfer Protocol (HTTP/1.1): Caching", RFC 7234, June 1072 2014. 1074 [W3C.REC-html401-19991224] 1075 Raggett, D., Hors, A., and I. Jacobs, "HTML 4.01 1076 Specification", World Wide Web Consortium Recommendation 1077 REC-html401-19991224, December 1999, 1078 . 1080 10.2. Informative References 1082 [I-D.perrin-tls-tack] 1083 Marlinspike, M., "Trust Assertions for Certificate Keys", 1084 draft-perrin-tls-tack-02 (work in progress), January 2013. 1086 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 1087 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 1088 May 2008. 1090 [why-pin-key] 1091 Langley, A., "Public Key Pinning", May 2011, 1092 . 1094 Appendix A. Fingerprint Generation 1096 This POSIX shell program generates SPKI Fingerprints, suitable for 1097 use in pinning, from PEM-encoded certificates. It is non-normative. 1099 openssl x509 -noout -in certificate.pem -pubkey | \ 1100 openssl asn1parse -noout -inform pem -out public.key 1101 openssl dgst -sha256 -binary public.key | base64 1103 Figure 10: Example SPKI Fingerprint Generation Code 1105 Appendix B. Deployment Guidance 1107 This section is non-normative guidance which may smooth the adoption 1108 of public key pinning. 1110 o Operators SHOULD get the backup public key signed by a different 1111 (root and/or intermediary) CA than their primary certificate, and 1112 store the backup key pair safely offline. The semantics of an 1113 SPKI Fingerprint do not require the issuance of a certificate to 1114 construct a valid Pin. However, in many deployment scenarios, in 1115 order to make a Backup Pin operational the server operator will 1116 need to have a certificate to deploy TLS on the host. Failure to 1117 obtain a certificate through prior arrangement will leave clients 1118 that recognize the site as a Known Pinned Host unable to 1119 successfully perform Pin Validation until such a time as the 1120 operator can obtain a new certificate from their desired 1121 certificate issuer. 1123 o It is most economical to have the backup certificate signed by a 1124 completely different signature chain than the live certificate, to 1125 maximize recoverability in the event of either root or 1126 intermediary signer compromise. 1128 o Operators SHOULD periodically exercise their Backup Pin plan -- an 1129 untested backup is no backup at all. 1131 o Operators SHOULD start small. Operators SHOULD first deploy 1132 public key pinning by using the report-only mode together with a 1133 report-uri directive that points to a reliable report collection 1134 endpoint. When moving out of report-only mode, operators should 1135 start by setting a max-age of minutes or a few hours, and 1136 gradually increase max-age as they gain confidence in their 1137 operational capability. 1139 Authors' Addresses 1141 Chris Evans 1142 Google, Inc. 1143 1600 Amphitheatre Pkwy 1144 Mountain View, CA 94043 1145 US 1147 Email: cevans@google.com 1149 Chris Palmer 1150 Google, Inc. 1151 1600 Amphitheatre Pkwy 1152 Mountain View, CA 94043 1153 US 1155 Email: palmer@google.com 1157 Ryan Sleevi 1158 Google, Inc. 1159 1600 Amphitheatre Pkwy 1160 Mountain View, CA 94043 1161 US 1163 Email: sleevi@google.com