idnits 2.17.1 draft-ietf-websec-key-pinning-15.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 2 instances of too long lines in the document, the longest one being 2 characters in excess of 72. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (June 16, 2014) is 3602 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) == Unused Reference: 'RFC5226' is defined on line 1043, but no explicit reference was found in the text == Outdated reference: A later version (-10) exists of draft-josefsson-pkix-textual-03 ** Obsolete normative reference: RFC 2616 (Obsoleted by RFC 7230, RFC 7231, RFC 7232, RFC 7233, RFC 7234, RFC 7235) ** Obsolete normative reference: RFC 4627 (Obsoleted by RFC 7158, RFC 7159) ** Obsolete normative reference: RFC 4634 (Obsoleted by RFC 6234) ** Obsolete normative reference: RFC 5226 (Obsoleted by RFC 8126) ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) Summary: 6 errors (**), 0 flaws (~~), 3 warnings (==), 1 comment (--). 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 18, 2014 Google, Inc. 6 June 16, 2014 8 Public Key Pinning Extension for HTTP 9 draft-ietf-websec-key-pinning-15 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 18, 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 . . . . . . . . . . . . . . . 24 95 Appendix B. Deployment Guidance . . . . . . . . . . . . . . . . 24 96 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 25 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 HTTP response header field (PKP header field) and 133 Public-Key-Pins-Report-Only response header field (PKP-RO header 134 field) indicate to a UA that it should perform Pin Validation 135 (Section 2.6) in regards to the host emitting the response message 136 containing these header fields, and provide the necessary information 137 for the UA to do so. 139 Figure 1 describes the syntax (Augmented Backus-Naur Form) of the 140 header field. It is based on the Generic Grammar defined in 141 Section 2 of [RFC2616] (which includes a notion of "implied linear 142 whitespace", also known as "implied *LWS"). 144 Public-Key-Pins = 145 "Public-Key-Pins" ":" [ directive ] *( ";" [ directive ] ) 146 Public-Key-Pins-Report-Only = 147 "Public-Key-Pins-Report-Only" ":" [ directive ] *( ";" [ directive ] ) 149 directive = simple-directive 150 / pin-directive 152 simple-directive = directive-name [ "=" directive-value ] 153 directive-name = token 154 directive-value = token 155 / quoted-string 157 pin-directive = "pin-" token "=" quoted-string 159 Figure 1: HPKP Header Syntax 161 token and quoted-string are used as defined in [RFC2616], 162 Section 2.2. 164 The directives defined in this specification are described below. 165 The overall requirements for directives are: 167 1. The order of appearance of directives is not significant. 169 2. All simple-directives MUST appear only once in a PKP header 170 field. Directives are either optional or required, as stipulated 171 in their definitions. 173 3. Directive names are case-insensitive. 175 4. UAs MUST ignore any PKP header fields containing directives, or 176 other header field value data, that do not conform to the syntax 177 defined in this specification. 179 5. If a PKP header field contains any directive(s) the UA does not 180 recognize, the UA MUST ignore those directives. 182 6. If the PKP header field otherwise satisfies the above 183 requirements (1 through 5), the UA MUST process the directives it 184 recognizes. 186 Additional directives extending the semantic functionality of the PKP 187 header field can be defined in other specifications, with a registry 188 (having an IANA policy definition of IETF Review [RFC2616]) defined 189 for them at such time. Such future directives will be ignored by UAs 190 implementing only this specification, as well as by generally non- 191 conforming UAs. 193 In the pin-directive, the token is the name of a cryptographic hash 194 algorithm, and MUST be "sha256". (In the future, additional hash 195 algorithms MAY be registered and used.) The quoted-string is a 196 sequence of base 64 digits: the base 64-encoded SPKI Fingerprint 197 ([RFC4648]). See Section 2.4. 199 The UA MUST ignore pin-directives with tokens naming hash algorithms 200 it does not recognize. If the set of remaining effective pin- 201 directives is empty, and if the connection passed Pin Validation with 202 the UA's existing noted pins for the Host (i.e. the Host is a Known 203 Pinned Host), the UA MUST cease to consider the Host as a Known 204 Pinned Host. (I.e. the UA should fail open.) The UA SHOULD indicate 205 to users that the Host is no longer a Known Pinned Host. 207 2.1.1. The max-age Directive 209 The REQUIRED "max-age" directive specifies the number of seconds, 210 after the reception of the PKP header field, during which the UA 211 SHOULD regard the host (from whom the message was received) as a 212 Known Pinned Host. The delta-seconds production is specified in 213 [RFC2616]. 215 The syntax of the max-age directive's REQUIRED value (after quoted- 216 string unescaping, if necessary) is defined as: 218 max-age-value = delta-seconds 219 delta-seconds = 1*DIGIT 221 Figure 2: max-age Value Syntax 223 delta-seconds is used as defined in [RFC2616], Section 3.3.2. 225 2.1.2. The includeSubDomains Directive 227 The OPTIONAL includeSubDomains directive is a valueless directive 228 which, if present (i.e., it is "asserted"), signals to the UA that 229 the Pinning Policy applies to this Pinned Host as well as any 230 subdomains of the host's domain name. 232 2.1.3. The report-uri Directive 234 The OPTIONAL report-uri directive indicates the URI to which the UA 235 SHOULD report Pin Validation failures (Section 2.6). The UA POSTs 236 the reports to the given URI as described in Section 3. 238 When used in the PKP or PKP-RO headers, the presence of a report-uri 239 directive indicates to the UA that in the event of Pin Validation 240 failure it SHOULD POST a report to the report-uri. If the header is 241 Public-Key-Pins, the UA should do this in addition to terminating the 242 connection (as described in Section 2.6). 244 Hosts may set report-uris that use HTTP, HTTPS, or other schemes. If 245 the scheme in the report-uri is one that uses TLS (e.g. HTTPS or 246 WSS), UAs MUST perform Pinning Validation when the host in the 247 report-uri is a Known Pinned Host; similarly, UAs MUST apply HSTS if 248 the host in the report-uri is a Known HSTS Host. 250 Note that the report-uri need not necessarily be in the same Internet 251 domain or web origin as the Known Pinned Host. 253 UAs SHOULD make their best effort to report Pin Validation failures 254 to the report-uri, but may fail to report in exceptional conditions. 255 For example, if connecting the report-uri itself incurs a Pinning 256 Validation failure or other certificate validation failure, the UA 257 MUST cancel the connection. Similarly, if Known Pinned Host A sets a 258 report-uri referring to Known Pinned Host B, and if B sets a report- 259 uri referring to A, and if both hosts fail Pin Validation, the UA 260 SHOULD detect and break the loop by failing to send reports to and 261 about those hosts. 263 In any case of report failure, the UA MAY attempt to re-send the 264 report later. 266 UAs SHOULD limit the rate at which they send reports. For example, 267 it is unnecessary to send the same report to the same report-uri more 268 than once per distinct set of declared pins. 270 2.1.4. Examples 272 Figure 3 shows some example response header fields using the Pins 273 extension. (Lines are folded to fit.) 274 Public-Key-Pins: max-age=3000; 275 pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM="; 276 pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; 278 Public-Key-Pins: max-age=2592000; 279 pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; 280 pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ=" 282 Public-Key-Pins: max-age=2592000; 283 pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; 284 pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; 285 report-uri="http://example.com/pkp-report" 287 Public-Key-Pins-Report-Only: max-age=2592000; 288 pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; 289 pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; 290 report-uri="https://other.example.net/pkp-report" 292 Public-Key-Pins: 293 pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM="; 294 pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; 295 max-age=259200 297 Public-Key-Pins: 298 pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM="; 299 pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; 300 pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; 301 max-age=10000; includeSubDomains 303 Figure 3: HPKP Header Examples 305 2.2. Server Processing Model 307 This section describes the processing model that Pinned Hosts 308 implement. The model has 2 parts: (1) the processing rules for HTTP 309 request messages received over a secure transport (e.g. TLS); and 310 (2) the processing rules for HTTP request messages received over non- 311 secure transports, such as TCP. 313 2.2.1. HTTP-over-Secure-Transport Request Type 315 When replying to an HTTP request that was conveyed over a secure 316 transport, a Pinned Host SHOULD include in its response exactly one 317 PKP header field, exactly one PKP-RO header field, or one of each. 318 Each instance of either header field MUST satisfy the grammar 319 specified in Section 2.1. 321 Establishing a given host as a Known Pinned Host, in the context of a 322 given UA, MAY be accomplished over the HTTP protocol, which is in 323 turn running over secure transport, by correctly returning (per this 324 specification) at least one valid PKP header field to the UA. Other 325 mechanisms, such as a client-side pre-loaded Known Pinned Host list 326 MAY also be used. 328 2.2.2. HTTP Request Type 330 Pinned Hosts SHOULD NOT include the PKP header field in HTTP 331 responses conveyed over non-secure transport. UAs MUST ignore any 332 PKP header received in an HTTP response conveyed over non-secure 333 transport. 335 2.3. User Agent Processing Model 337 The UA processing model relies on parsing domain names. Note that 338 internationalized domain names SHALL be canonicalized according to 339 the scheme in Section 10 of [RFC6797]. 341 2.3.1. Public-Key-Pins Response Header Field Processing 343 If the UA receives, over a secure transport, an HTTP response that 344 includes a PKP header field conforming to the grammar specified in 345 Section 2.1, and there are no underlying secure transport errors or 346 warnings (see Section 2.5), the UA MUST either: 348 o Note the host as a Known Pinned Host if it is not already so noted 349 (see Section 2.3.3), 351 or, 353 o Update the UA's cached information for the Known Pinned Host if 354 any of of the max-age, includeSubDomains, or report-uri header 355 field value directives convey information different than that 356 already maintained by the UA. 358 o The max-age value is essentially a "time to live" value relative 359 to the time of the most recent observation of the PKP header 360 field. 362 o If the max-age header field value token has a value of 0, the UA 363 MUST remove its cached Pinning Policy information (including the 364 includeSubDomains directive, if asserted) if the Pinned Host is 365 Known, or, MUST NOT note this Pinned Host if it is not yet Known. 367 o If a UA receives more than one PKP header field or more than one 368 PKP-RO header fieled in an HTTP response message over secure 369 transport, then the UA MUST process only the first PKP header 370 field (if present) and only the first PKP-RO header field (if 371 present). 373 Otherwise: 375 o If the UA receives the HTTP response over insecure transport, or 376 if the PKP header is not a Valid Pinning Header (see Section 2.5), 377 the UA MUST ignore any present PKP header field(s). 379 o Similarly, if the UA receives the HTTP response over insecure 380 transport, the UA MUST ignore any present PKP-RO header field(s). 382 o The UA MUST ignore any PKP or PKP-RO header fields not conforming 383 to the grammar specified in Section 2.1. 385 2.3.2. Interaction of Public-Key-Pins and Public-Key-Pins-Report-Only 387 A server MAY set both the Public-Key-Pins and Public-Key-Pins-Report- 388 Only headers simultaneously. The headers do not interact with one 389 another but the UA MUST process the PKP header and SHOULD process 390 both. 392 The headers are processed according to Section 2.3.1. 394 When the PKP-RO header is used with a report-uri, the UA SHOULD POST 395 reports for Pin Validation failures to the indicated report-uri, 396 although the UA MUST NOT enforce Pin Validation. That is, in the 397 event of Pin Validation failure when the host has set the PKP-RO 398 header, the UA performs Pin Validation only to check whether or not 399 it should POST a report, but not for causing connection failure. 401 Note: There is no purpose to using the PKP-RO header without the 402 report-uri directive. User Agents MAY discard such headers without 403 interpreting them further. 405 When the PKP header is used with a report-uri, the UA SHOULD POST 406 reports for Pin Validation failures to the indicated report-uri, as 407 well as enforcing Pin Validation. 409 If a Host sets the PKP-RO header, the UA SHOULD note the Pins and 410 directives given in the PKP-RO header as specified by the max-age 411 directive. If the UA does note the Pins and directives in the PKP-RO 412 header it SHOULD evaluate the specified policy and SHOULD report any 413 would-be Pin Validation failures that would occur if the report-only 414 policy were enforced. 416 If a Host sets both the PKP header and the PKP-RO header, the UA MUST 417 note and enforce Pin Validation as specified by the PKP header, and 418 SHOULD process the Pins and directives given in the PKP-RO header. 419 If the UA does process the Pins and directives in the PKP-RO header 420 it SHOULD evaluate the specified policy and SHOULD report any would- 421 be Pin Validation failures that would occur if the report-only policy 422 were enforced. 424 2.3.3. Noting a Pinned Host - Storage Model 426 The Effective Pin Date of a Known Pinned Host is the time that the UA 427 observed a Valid Pinning Header for the host. The Effective 428 Expiration Date of a Known Pinned Host is the Effective Pin Date plus 429 the max-age. A Known Pinned Host is "expired" if the Effective 430 Expiration Date refers to a date in the past. The UA MUST ignore all 431 expired Known Pinned Hosts from its cache if, at any time, an expired 432 Known Pinned Host exists in the cache. 434 If the substring matching the host production from the Request-URI 435 (of the message to which the host responded) syntactically matches 436 the IP-literal or IPv4address productions from Section 3.2.2 of 437 [RFC3986], then the UA MUST NOT note this host as a Known Pinned 438 Host. 440 Otherwise, if the substring does not congruently match a Known Pinned 441 Host's domain name, per the matching procedure specified in 442 Section 8.2 of [RFC6797], then the UA MUST note this host as a Known 443 Pinned Host, caching the Pinned Host's domain name and noting along 444 with it the Effective Expiration Date (or enough information to 445 calculate it, i.e. the Effective Pin Date and the value of the max- 446 age directive), whether or not the includeSubDomains directive is 447 asserted, the value of the report-uri directive (if present). If any 448 other metadata from optional or future PKP header directives is 449 present in the Valid Pinning Header, the UA MAY note them if it 450 understands them, and need not note them if it does not understand 451 them. 453 UAs MAY set an upper limit on the value of max-age, so that UAs that 454 have noted erroneous Pins (whether by accident or due to attack) have 455 some chance of recovering over time. If the server sets a max-age 456 greater than the UA's upper limit, the UA MAY behave as if the server 457 set the max-age to the UA's upper limit. For example, if the UA caps 458 max-age at 5184000 seconds (60 days), and a Pinned Host sets a max- 459 age directive of 90 days in its Valid Pinning Header, the UA MAY 460 behave as if the max-age were effectively 60 days. (One way to 461 achieve this behavior is for the UA to simply store a value of 60 462 days instead of the 90 day value provided by the Pinned Host.) For 463 UA implementation guidance on how to select a maximum max-age, see 464 Section 4.1. 466 The UA MUST NOT modify any pinning metadata of any superdomain 467 matched Known Pinned Host. 469 2.3.4. HTTP-Equiv Element Attribute 471 UAs MUST NOT heed http-equiv="Public-Key-Pins" or http-equiv="Public- 472 Key-Pins-Report-Only" attribute settings on elements 473 [W3C.REC-html401-19991224] in received content. 475 2.4. Semantics of Pins 477 An SPKI Fingerprint is defined as the output of a known cryptographic 478 hash algorithm whose input is the DER-encoded ASN.1 representation of 479 the subjectPublicKeyInfo (SPKI) field of an X.509 certificate. A Pin 480 is defined as the combination of the known algorithm identifier and 481 the SPKI Fingerprint computed using that algorithm. 483 The SPKI Fingerprint is encoded in base 64 for use in an HTTP header. 484 (See [RFC4648].) 486 In this version of the specification, the known cryptographic hash 487 algorithm is SHA-256, identified as "sha256" ([RFC4634]). (Future 488 versions of this specification may add new algorithms and deprecate 489 old ones.) UAs MUST ignore Pins for which they do not recognize the 490 algorithm identifier. UAs MUST continue to process the rest of a PKP 491 response header field and note Pins for algorithms they do recognize; 492 UAs MUST recognize "sha256". 494 Figure 4 reproduces the definition of the SubjectPublicKeyInfo 495 structure in [RFC5280]. 497 SubjectPublicKeyInfo ::= SEQUENCE { 498 algorithm AlgorithmIdentifier, 499 subjectPublicKey BIT STRING } 501 AlgorithmIdentifier ::= SEQUENCE { 502 algorithm OBJECT IDENTIFIER, 503 parameters ANY DEFINED BY algorithm OPTIONAL } 505 Figure 4: SPKI Definition 507 If the certificate's subjectPublicKeyInfo is incomplete when taken in 508 isolation, such as when holding a DSA key without domain parameters, 509 a public key pin cannot be formed. Hence, pins using these keys 510 cannot be pinned. 512 We pin public keys, rather than entire certificates, to enable 513 operators to generate new certificates containing old public keys 514 (see [why-pin-key]). 516 See Appendix A for an example non-normative program that generates 517 SPKI Fingerprints from certificates. 519 2.5. Noting Pins 521 Upon receipt of the PKP response header field, the UA notes the host 522 as a Pinned Host, storing the Pins and their associated directives in 523 non-volatile storage (for example, along with the HSTS metadata). 524 The Pins and their associated directives are collectively known as 525 Pinning Metadata. 527 The UA MUST observe these conditions when noting a Host: 529 o The UA MUST note the Pins if and only if it received the PKP 530 response header field over an error-free TLS connection. If the 531 host is a Pinned Host, this includes the validation added in 532 Section 2.6. 534 o The UA MUST note the Pins if and only if the TLS connection was 535 authenticated with a certificate chain containing at least one of 536 the SPKI structures indicated by at least one of the given SPKI 537 Fingerprints. (See Section 2.6.) 539 o The UA MUST note the Pins if and only if the given set of Pins 540 contains at least one Pin that does NOT refer to an SPKI in the 541 certificate chain. (That is, the host must set a Backup Pin; see 542 Section 4.3.) 544 If the PKP response header field does not meet all three of these 545 criteria, the UA MUST NOT note the host as a Pinned Host. A PKP 546 response header field that meets all these critera is known as a 547 Valid Pinning Header. 549 Whenever a UA receives a Valid Pinning Header, it MUST set its 550 Pinning Metadata to the exact Pins, Effective Expiration Date 551 (computed from max-age), and (if any) report-uri given in the most 552 recently received Valid Pinning Header. 554 For forward compatibility, the UA MUST ignore any unrecognized PKP 555 and PKP-RO header directives, while still processing those directives 556 it does recognize. Section 2.1 specifies the directives max-age, 557 Pins, includeSubDomains, and report-uri but future specifications and 558 implementations might use additional directives. 560 Upon receipt of a PKP-RO response header field, the UA SHOULD 561 evaluate the policy expressed in the field, and SHOULD generate and 562 send a report (see Section 3). However, failure to validate the pins 563 in the field MUST have no effect on the validity or non-validity of 564 the policy expressed in the PKP field or in previously-noted pins for 565 the Known Pinned Host. 567 The UA need not note any pins or other policy expressed in the PKP-RO 568 response header field, except for the purpose of determining that it 569 has already sent a report for a given policy. UAs SHOULD make a best 570 effort not to inundate report-uris with redundant reports. 572 2.6. Validating Pinned Connections 574 When a UA connects to a Pinned Host, if the TLS connection has 575 errors, the UA MUST terminate the connection without allowing the 576 user to proceed anyway. (This behavior is the same as that required 577 by [RFC6797].) 579 If the connection has no errors, then the UA will determine whether 580 to apply a new, additional correctness check: Pin Validation. A UA 581 SHOULD perform Pin Validation whenever connecting to a Known Pinned 582 Host, but MAY allow Pin Validation to be disabled for Hosts according 583 to local policy. For example, a UA may disable Pin Validation for 584 Pinned Hosts whose validated certificate chain terminates at a user- 585 defined trust anchor, rather than a trust anchor built-in to the UA. 587 To perform Pin Validation, the UA will compute the SPKI Fingerprints 588 for each certificate in the Pinned Host's validated certificate 589 chain, using each supported hash algorithm for each certificate. (As 590 described in Section 2.4, certificates whose SPKI cannot be taken in 591 isolation cannot be pinned.) The UA MUST ignore superfluous 592 certificates in the chain that do not form part of the validating 593 chain. The UA will then check that the set of these SPKI 594 Fingerprints intersects the set of SPKI Fingerprints in that Pinned 595 Host's Pinning Metadata. If there is set intersection, the UA 596 continues with the connection as normal. Otherwise, the UA MUST 597 treat this Pin Validation Failure as a non-recoverable error. Any 598 procedure that matches the results of this Pin Validation procedure 599 is considered equivalent. 601 Although the UA has previously received Pins at the HTTP layer, it 602 can and MUST perform Pin Validation at the TLS layer, before 603 beginning an HTTP conversation over the TLS channel. The TLS layer 604 thus evaluates TLS connections with pinning information the UA 605 received previously, regardless of mechanism: statically preloaded, 606 via HTTP header, or some other means (possibly in the TLS layer 607 itself). 609 If Pin Validation is not in effect (e.g. because the user has elected 610 to disable it, or because a presented certificate chain chains up to 611 a locally-installed anchor), and if the server has set a report-uri 612 in a PKP or PKP-RO header, the UA SHOULD NOT send any reports to the 613 report-uri for the given certificate chain. 615 2.7. Interactions With Preloaded Pin Lists 617 UAs MAY choose to implement additional sources of pinning 618 information, such as through built-in lists of pinning information. 619 Such UAs SHOULD allow users to override such additional sources, 620 including disabling them from consideration. 622 The effective policy for a Known Pinned Host that has both built-in 623 pins and pins from previously observed PKP header response fields is 624 implementation-defined. 626 2.8. Pinning Self-Signed End Entities 628 If UAs accept hosts that authenticate themselves with self-signed end 629 entity certificates, they MAY also allow hosts to pin the public keys 630 in such certificates. The usability and security implications of 631 this practice are outside the scope of this specification. 633 3. Reporting Pin Validation Failure 635 When a Known Pinned Host has set the report-uri directive, the UA 636 SHOULD report Pin Validation failures to the indicated URI. The UA 637 does this by POSTing a JSON ([RFC4627]) message to the URI; the JSON 638 message takes this form: 640 { 641 "date-time": date-time, 642 "hostname": hostname, 643 "port": port, 644 "effective-expiration-date": expiration-date, 645 "include-subdomains": include-subdomains, 646 "served-certificate-chain": [ 647 pem1, ... pemN 648 ], 649 "validated-certificate-chain": [ 650 pem1, ... pemN 651 ], 652 "known-pins": [ 653 known-pin1, ... known-pinN 654 ] 655 } 657 Figure 5: JSON Report Format 659 Whitespace outside of quoted strings is not significant. The key/ 660 value pairs may appear in any order, but each MUST appear only once. 662 The date-time indicates the time the UA observed the Pin Validation 663 failure. It is provided as a string formatted according to 664 Section 5.6, "Internet Date/Time Format", of [RFC3339]. 666 The hostname is the hostname to which the UA made the original 667 request that failed Pin Validation. It is provided as a string. 669 The port is the port to which the UA made the original request that 670 failed Pin Validation. It is provided as an integer. 672 The effective-expiration-date is the Effective Expiration Date for 673 the noted Pins. It is provided as a string formatted according to 674 Section 5.6, "Internet Date/Time Format", of [RFC3339]. 676 include-subdomains indicates whether or not the UA has noted the 677 includeSubDomains directive for the Known Pinned Host. It is 678 provided as one of the JSON identifiers true or false. 680 The served-certificate-chain is the certificate chain, as served by 681 the Known Pinned Host during TLS session setup. It is provided as an 682 array of strings; each string pem1, ... pemN is the PEM 683 representation of each X.509 certificate as described in 684 [I-D.josefsson-pkix-textual]. 686 The validated-certificate-chain is the certificate chain, as 687 constructed by the UA during certificate chain verification. (This 688 may differ from the served-certificate-chain.) It is provided as an 689 array of strings; each string pem1, ... pemN is the PEM 690 representation of each X.509 certificate as described in 691 [I-D.josefsson-pkix-textual]. For UAs that build certificate chains 692 in more than one way during the validation process, they SHOULD send 693 the last chain built. In this way they can avoid keeping too much 694 state during the validation process. 696 The known-pins are the Pins that the UA has noted for the Known 697 Pinned Host. They are provided as an array of strings with the 698 syntax: 700 known-pin = token "=" quoted-string 702 Figure 6: Known Pin Syntax 704 As in Section 2.4, the token refers to the algorithm name, and the 705 quoted-string refers to the base 64 encoding of the SPKI Fingerprint. 706 When formulating the JSON POST body, the UA MUST either use single- 707 quoted JSON strings, or use double-quoted JSON strings and \-escape 708 the embedded double quotes in the quoted-string part of the known- 709 pin. 711 Figure 7 shows an example of a Pin Validation failure report. (PEM 712 strings are shown on multiple lines for readability.) 714 { 715 "date-time": "2014-04-06T13:00:50Z", 716 "hostname": "www.example.com", 717 "port": 443, 718 "effective-expiration-date": "2014-05-01T12:40:50Z" 719 "include-subdomains": false, 720 "served-certificate-chain": [ 721 "-----BEGIN CERTIFICATE-----\n 722 MIIEBDCCAuygAwIBAgIDAjppMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT\n 723 ... 724 HFa9llF7b1cq26KqltyMdMKVvvBulRP/F/A8rLIQjcxz++iPAsbw+zOzlTvjwsto\n 725 WHPbqCRiOwY1nQ2pM714A5AuTHhdUDqB1O6gyHA43LL5Z/qHQF1hwFGPa4NrzQU6\n 726 yuGnBXj8ytqU0CwIPX4WecigUCAkVDNx\n 727 -----END CERTIFICATE-----", 728 ... 729 ], 730 "validated-certificate-chain": [ 731 "-----BEGIN CERTIFICATE-----\n 732 MIIEBDCCAuygAwIBAgIDAjppMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT\n 733 ... 734 HFa9llF7b1cq26KqltyMdMKVvvBulRP/F/A8rLIQjcxz++iPAsbw+zOzlTvjwsto\n 735 WHPbqCRiOwY1nQ2pM714A5AuTHhdUDqB1O6gyHA43LL5Z/qHQF1hwFGPa4NrzQU6\n 736 yuGnBXj8ytqU0CwIPX4WecigUCAkVDNx\n 737 -----END CERTIFICATE-----", 738 ... 739 ], 740 "known-pins": [ 741 'pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM="', 742 "pin-sha256=\"E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=\"" 743 ] 744 } 746 Figure 7: Pin Validation Failure Report Example 748 4. Security Considerations 750 Pinning public keys helps hosts strongly assert their cryptographic 751 identity even in the face of issuer error, malfeasance or compromise. 752 But there is some risk that a host operator could lose or lose 753 control of their host's private key (such as by operator error or 754 host compromise). If the operator had pinned only the key of the 755 host's end entity certificate, the operator would not be able to 756 serve their web site or application in a way that UAs would trust for 757 the duration of their pin's max-age. (Recall that UAs MUST close the 758 connection to a host upon Pin Failure.) 760 Therefore, there is a necessary trade-off between two competing 761 goods: pin specificity and maximal reduction of the scope of issuers 762 on the one hand; and flexibility and resilience of the host's 763 cryptographic identity on the other hand. One way to resolve this 764 trade-off is to compromise by pinning to the key(s) of the issuer(s) 765 of the host's end entity certificate(s). Often, a valid certificate 766 chain will have at least two certificates above the end entity 767 certificate: the intermediate issuer, and the trust anchor. 768 Operators can pin any one or more of the public keys in this chain, 769 and indeed could pin to issuers not in the chain (as, for example, a 770 Backup Pin). Pinning to an intermediate issuer, or even to a trust 771 anchor or root, still significantly reduces the number of issuers who 772 can issue end entity certificates for the Known Pinned Host, while 773 still giving that host flexibility to change keys without a 774 disruption of service. 776 4.1. Maximum max-age 778 As mentioned in Section 2.3.3, UAs MAY cap the max-age value at some 779 upper limit. There is a security trade-off in that low maximum 780 values provide a narrow window of protection for users who visit the 781 Known Pinned Host only infrequently, while high maximum values might 782 potentially result in a UA's inability to successfully perform Pin 783 Validation for a Known Pinned Host if the UA's noted Pins and the 784 Host's true Pins diverge. 786 Such divergence could occur for several reasons, including: UA error; 787 Host operator error; network attack; or a Known Pinned Host that 788 intentionally migrates all pinned keys, combined with a UA that has 789 noted true Pins with a high max-age value and has not had a chance to 790 observe the new true Pins for the Host. (This last example 791 underscores the importance for Host operators to phase in new keys 792 gradually, and to set the max-age value in accordance with their 793 planned key migration schedule.) 795 There is probably no ideal upper limit to the max-age directive that 796 would satisfy all use cases. However, a value on the order of 60 797 days (5,184,000 seconds) may be considered a balance between the two 798 competing security concerns. 800 4.2. Using includeSubDomains Safely 802 It may happen that Pinned Hosts whose hostnames share a parent domain 803 use different Valid Pinning Headers. If a Host whose hostname is a 804 parent domain for another Host sets the includeSubDomains directive, 805 the two Hosts' Pins may conflict with each other. For example, 806 consider two Known Pinned Hosts, example.com and 807 subdomain.example.com. Assume example.com sets a Valid Pinning 808 Header such as this: 810 Public-Key-Pins: max-age=12000; pin-sha256="ABC..."; pin-sha256="DEF..."; 811 includeSubDomains 813 Figure 8: example.com Valid Pinning Header 815 Assume subdomain.example.com sets a Valid Pinning Header such as 816 this: 818 Public-Key-Pins: pin-sha256="GHI..."; pin-sha256="JKL..." 820 Figure 9: subdomain.example.com Valid Pinning Header 822 Assume a UA that has not previously noted any Pins for either of 823 these Hosts. If the UA first contacts subdomain.example.com, it will 824 note the Pins in the Valid Pinning Header, and perform Pin Validation 825 as normal on subsequent conections. If the UA then contacts 826 example.com, again it will note the Pins and perform Pin Validation 827 on future connections. 829 However, if the UA happened to visit example.com before 830 subdomain.example.com, the UA would, due to example.com's use of the 831 includeSubDomains directive, attempt to perform Pin Validation for 832 subdomain.example.com using the SPKI hashes ABC... and DEF..., which 833 are not valid for the certificate chains subdomain.example.com (which 834 uses certificates with SPKIs GHI... and JLK...). Thus, depending on 835 the order in which the UA observes the Valid Pinning Headers for 836 hosts example.com and subdomain.example.com, Pin Validation might or 837 might not fail for subdomain.example.com, even if the certificate 838 chain the UA receives for subdomain.example.com is perfectly valid. 840 Thus, Pinned Host operators must use the includeSubDomains directive 841 with care. For example, they may choose to use overlapping pin sets 842 for hosts under a parent domain that uses includeSubDomains, or to 843 not use the includeSubDomains directive in their effective-second- 844 level domains, or to simply use the same pin set for all hosts under 845 a given parent domain. 847 4.3. Backup Pins 849 The primary way to cope with the risk of inadvertent Pin Validation 850 Failure is to keep a Backup Pin. A Backup Pin is a fingerprint for 851 the public key of a secondary, not-yet-deployed key pair. The 852 operator keeps the backup key pair offline, and sets a pin for it in 853 the PKP header. Then, in case the operator loses control of their 854 primary private key, they can deploy the backup key pair. UAs, who 855 have had the backup key pair pinned (when it was set in previous 856 Valid Pinning Headers), can connect to the host without error. 858 Because having a backup key pair is so important to recovery, UAs 859 MUST require that hosts set a Backup Pin. (See Section 2.5.) 861 4.4. Interactions With Cookie Scoping 863 HTTP cookies [RFC6265] set by a Known Pinned Host can be stolen by a 864 network attacker who can forge web and DNS responses so as to cause a 865 client to send the cookies to a phony subdomain of the Host. To 866 prevent this, Hosts SHOULD set the "secure" attribute and omit the 867 "domain" attribute on all security-sensitive cookies, such as session 868 cookies. These settings tell the browser that the cookie should only 869 be sent back to the originating host (not its subdomains), and should 870 only be sent over HTTPS (not HTTP). 872 5. Privacy Considerations 874 Hosts can use HSTS or HPKP as a "super-cookie", by setting distinct 875 policies for a number of subdomains. For example, assume example.com 876 wishes to track distinct UAs without explicitly setting a cookie, or 877 if a previously-set cookie is deleted from the UA's cookie store. 878 Here are two attack scenarios. 880 o example.com can use report-uri and the ability to pin arbitrary 881 identifiers to distinguish UAs. 883 1. example.com sets a Valid Pinning Header in its response to 884 requests. The header asserts the includeSubDomains directive, 885 and specifies a report-uri directive as well. Pages served by 886 the host also include references to subresource 887 https://bad.example.com/foo.png. 889 2. The Valid Pinning Header includes a "pin" that is not really 890 the hash of an SPKI, but is instead an arbitrary 891 distinguishing string sent only in response to a particular 892 request. For each request, the Host creates a new, distinct 893 distinguishing string and sets it as if it were a pin. 895 3. The certificate chain served by bad.example.com does not pass 896 Pin Validation given the pin set the Host asserted in (1). 897 The HPKP-conforming UA attempts to report the Pin Validation 898 failure to the specified report-uri, including the certificate 899 chain it observed and the SPKI hashes it expected to see. 900 Among the SPKI hashes is the distinguishing string in step 901 (2). 903 4. Different site operators/origins can optionally collaborate by 904 setting the report-uri to be in an origin they share 905 administrative control of. UAs MAY, therefore, refuse to send 906 reports outside of the origin that set the PKP or PKP-RO 907 header. 909 o example.com can use SNI and subdomains to distinguish UAs. 911 1. example.com sets a Valid Pinning Header in its response to 912 requests. The header asserts the includeSubDomains directive. 914 2. On a subsequent page view, the Host responds with a page 915 including the subresource https://0.fingerprint.example.com/ 916 foo.png, and the server responds using a certificate chain 917 that does not pass Pin Validation for the pin-set defined in 918 the Valid Pinning Header in step (1). The HPKP-conforming UA 919 will close the connection, never completing the request to 920 0.fingerprint.example.com. The Host may thus note that this 921 particular UA had noted the (good) Pins for that subdomain. 923 3. example.com can distinguish 2^N UAs by serving Valid Pinning 924 Headers from an arbitrary number N distinct subdomains, giving 925 some UAs Valid Pinning Headers for some, but not all 926 subdomains (causing subsequent requests for 927 n.fingerprint.example.com to fail), and giving some UAs no 928 Valid Pinning Header for other subdomains (causing subsequent 929 requests for m.fingerprint.example.com to succeed). 931 Conforming implementations (as well as implementations conforming to 932 [RFC6797]) must store state about which domains have set policies, 933 hence which domains the UA has contacted. A forensic attacker might 934 find this information useful, even if the user has cleared other 935 parts of the UA's state. 937 6. IANA Considerations 939 IANA is requested to register the header described in this document 940 in the "Message Headers" registry, with the following parameters: 942 o Header Field Names should be "Public-Key-Pins" and "Public-Key- 943 Pins-Report-Only". 945 o Protocol should be "http" 947 o Status should be "standard" 949 o Reference should be this document 951 7. Usability Considerations 953 When pinning works to detect impostor Pinned Hosts, users will 954 experience denial of service. UAs MUST explain the reason why, i.e. 955 that it was impossible to verify the confirmed cryptographic identity 956 of the host. 958 UAs MUST have a way for users to clear current Pins for Pinned Hosts. 959 UAs SHOULD have a way for users to query the current state of Pinned 960 Hosts. 962 8. Acknowledgements 964 Thanks to Tobias Gondrom, Jeff Hodges, Paul Hoffman, Ivan Krstic, 965 Adam Langley, Nicolas Lidzborski, SM, James Manger, Yoav Nir, Trevor 966 Perrin, Eric Rescorla, Tom Ritter, and Yan Zhu for suggestions and 967 edits that clarified the text. 969 9. What's Changed 971 [RFC EDITOR: PLEASE REMOVE THIS SECTION] 973 Removed the strict directive. 975 Removed the requirement that the server set the Valid Pinning Header 976 on every response. 978 Added normative references for SHA, JSON, and base-64. 980 Added the Privacy Considerations section. 982 Changed non-normative pin generation code from Go to POSIX shell 983 script using openssl. 985 Changed max-max-age from SHOULD to MAY, and used the example of 60 986 days instead of 30. 988 Removed the section "Pin Validity Times", which was intended to be in 989 harmony with [I-D.perrin-tls-tack]. Now using max-age purely as 990 specified in [RFC6797]. 992 Added new directives: includeSubDomains, report-uri and strict. 994 Added a new variant of the PKP Header: Public-Key-Pins-Report-Only. 996 Removed the section on pin break codes and verifiers, in favor the of 997 most-recently-received policy (Section 2.5). 999 Now using a new header field, Public-Key-Pins, separate from HSTS. 1000 This allows hosts to use pinning separately from Strict Transport 1001 Security. 1003 Explicitly requiring that UAs perform Pin Validation before the HTTP 1004 conversation begins. 1006 Backup Pins are now required. 1008 Separated normative from non-normative material. Removed tangential 1009 and out-of-scope non-normative discussion. 1011 10. References 1013 10.1. Normative References 1015 [I-D.josefsson-pkix-textual] 1016 Josefsson, S. and S. Leonard, "Text Encodings of PKIX and 1017 CMS Structures", draft-josefsson-pkix-textual-03 (work in 1018 progress), April 2014. 1020 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1021 Requirement Levels", BCP 14, RFC 2119, March 1997. 1023 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 1024 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 1025 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. 1027 [RFC3339] Klyne, G., Ed. and C. Newman, "Date and Time on the 1028 Internet: Timestamps", RFC 3339, July 2002. 1030 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 1031 Resource Identifier (URI): Generic Syntax", STD 66, RFC 1032 3986, January 2005. 1034 [RFC4627] Crockford, D., "The application/json Media Type for 1035 JavaScript Object Notation (JSON)", RFC 4627, July 2006. 1037 [RFC4634] Eastlake, D. and T. Hansen, "US Secure Hash Algorithms 1038 (SHA and HMAC-SHA)", RFC 4634, July 2006. 1040 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 1041 Encodings", RFC 4648, October 2006. 1043 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 1044 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 1045 May 2008. 1047 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 1048 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 1050 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 1051 Housley, R., and W. Polk, "Internet X.509 Public Key 1052 Infrastructure Certificate and Certificate Revocation List 1053 (CRL) Profile", RFC 5280, May 2008. 1055 [RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265, 1056 April 2011. 1058 [RFC6797] Hodges, J., Jackson, C., and A. Barth, "HTTP Strict 1059 Transport Security (HSTS)", RFC 6797, November 2012. 1061 [W3C.REC-html401-19991224] 1062 Raggett, D., Hors, A., and I. Jacobs, "HTML 4.01 1063 Specification", World Wide Web Consortium Recommendation 1064 REC-html401-19991224, December 1999, 1065 . 1067 10.2. Informative References 1069 [I-D.perrin-tls-tack] 1070 Marlinspike, M., "Trust Assertions for Certificate Keys", 1071 draft-perrin-tls-tack-02 (work in progress), January 2013. 1073 [why-pin-key] 1074 Langley, A., "Public Key Pinning", May 2011, 1075 . 1077 Appendix A. Fingerprint Generation 1079 This POSIX shell program generates SPKI Fingerprints, suitable for 1080 use in pinning, from PEM-encoded certificates. It is non-normative. 1082 openssl x509 -noout -in certificate.pem -pubkey | \ 1083 openssl asn1parse -noout -inform pem -out public.key 1084 openssl dgst -sha256 -binary public.key | base64 1086 Figure 10: Example SPKI Fingerprint Generation Code 1088 Appendix B. Deployment Guidance 1090 This section is non-normative guidance which may smooth the adoption 1091 of public key pinning. 1093 o Operators SHOULD get the backup public key signed by a different 1094 (root and/or intermediary) CA than their primary certificate, and 1095 store the backup key pair safely offline. The semantics of an 1096 SPKI Fingerprint do not require the issuance of a certificate to 1097 construct a valid Pin. However, in many deployment scenarios, in 1098 order to make a Backup Pin operational the server operator will 1099 need to have a certificate to deploy TLS on the host. Failure to 1100 obtain a certificate through prior arrangement will leave clients 1101 that recognize the site as a Known Pinned Host unable to 1102 successfully perform Pin Validation until such a time as the 1103 operator can obtain a new certificate from their desired 1104 certificate issuer. 1106 o It is most economical to have the backup certificate signed by a 1107 completely different signature chain than the live certificate, to 1108 maximize recoverability in the event of either root or 1109 intermediary signer compromise. 1111 o Operators SHOULD periodically exercise their Backup Pin plan -- an 1112 untested backup is no backup at all. 1114 o Operators SHOULD start small. Operators SHOULD first deploy 1115 public key pinning by using the report-only mode together with a 1116 report-uri directive that points to a reliable report collection 1117 endpoint. When moving out of report-only mode, operators should 1118 start by setting a max-age of minutes or a few hours, and 1119 gradually increase max-age as they gain confidence in their 1120 operational capability. 1122 Authors' Addresses 1124 Chris Evans 1125 Google, Inc. 1126 1600 Amphitheatre Pkwy 1127 Mountain View, CA 94043 1128 US 1130 Email: cevans@google.com 1132 Chris Palmer 1133 Google, Inc. 1134 1600 Amphitheatre Pkwy 1135 Mountain View, CA 94043 1136 US 1138 Email: palmer@google.com 1139 Ryan Sleevi 1140 Google, Inc. 1141 1600 Amphitheatre Pkwy 1142 Mountain View, CA 94043 1143 US 1145 Email: sleevi@google.com