idnits 2.17.1 draft-ietf-websec-key-pinning-12.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 (April 29, 2014) is 3647 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 1045, but no explicit reference was found in the text == Outdated reference: A later version (-10) exists of draft-josefsson-pkix-textual-02 ** 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: October 31, 2014 Google, Inc. 6 April 29, 2014 8 Public Key Pinning Extension for HTTP 9 draft-ietf-websec-key-pinning-12 11 Abstract 13 This memo describes an extension to the HTTP protocol allowing web 14 host operators to instruct user agents (UAs) to remember ("pin") the 15 hosts' cryptographic identities for a given period of time. During 16 that 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 October 31, 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 . . . . . . . . . . . . . . 6 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 . . . . . . . . . . . . . . 12 78 2.7. Interactions With Preloaded Pin Lists . . . . . . . . . . 13 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 5. Privacy Considerations . . . . . . . . . . . . . . . . . . . 20 86 6. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 21 87 7. Usability Considerations . . . . . . . . . . . . . . . . . . 21 88 8. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 21 89 9. What's Changed . . . . . . . . . . . . . . . . . . . . . . . 22 90 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 22 91 10.1. Normative References . . . . . . . . . . . . . . . . . . 23 92 10.2. Informative References . . . . . . . . . . . . . . . . . 24 93 Appendix A. Fingerprint Generation . . . . . . . . . . . . . . . 24 94 Appendix B. Deployment Guidance . . . . . . . . . . . . . . . . 24 95 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 25 97 1. Introduction 99 We propose a new HTTP header to enable a web host to express to user 100 agents (UAs) which Subject Public Key Info (SPKI) structure(s) UAs 101 SHOULD expect to be present in the host's certificate chain in future 102 connections using TLS (see [RFC5246]). We call this "public key 103 pinning". At least one UA (Google Chrome) has experimented with the 104 idea by shipping with a user-extensible embedded set of Pins. 105 Although effective, this does not scale. This proposal addresses the 106 scale problem. 108 Deploying public key pinning safely will require operational and 109 organizational maturity due to the risk that hosts may make 110 themselves unavailable by pinning to a SPKI that becomes invalid. 111 (See Section 4.) We believe that, with care, host operators can 112 greatly reduce the risk of MITM attacks and other false- 113 authentication problems for their users without incurring undue risk. 115 We intend for hosts to use public key pinning together with HSTS 116 ([RFC6797]), but is possible to pin keys without requiring HSTS. 118 This draft is being discussed on the WebSec Working Group mailing 119 list, websec@ietf.org. 121 1.1. Requirements Language 123 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 124 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 125 document are to be interpreted as described in RFC 2119 [RFC2119]. 127 2. Server and Client Behavior 129 2.1. Response Header Field Syntax 131 The Public-Key-Pins HTTP response header field (PKP header field) 132 indicates to a UA that it should perform Pin Validation (Section 2.6) 133 in regards to the host emitting the response message containing this 134 header field, and provides the necessary information for the UA to do 135 so. 137 Figure 1 describes the ABNF (Augmented Backus-Naur Form) syntax of 138 the header field. It is based on the Generic Grammar defined in 139 Section 2 of [RFC2616] (which includes a notion of "implied linear 140 whitespace", also known as "implied *LWS"). 142 Public-Key-Pins = 143 "Public-Key-Pins" ":" [ directive ] *( ";" [ directive ] ) 144 Public-Key-Pins-Report-Only = 145 "Public-Key-Pins-Report-Only" ":" [ directive ] *( ";" [ 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 token and quoted-string are used as defined in [RFC2616], 160 Section 2.2. 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 PKP 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 PKP header fields containing directives, or 174 other header field value data, that do not conform to the syntax 175 defined in this specification. 177 5. If a PKP header field contains any directive(s) the UA does not 178 recognize, the UA MUST ignore those directives. 180 6. If the PKP 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 PKP 185 header field can be defined in other specifications, with a registry 186 (having an IANA policy definition of IETF Review [RFC2616]) 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 REQUIRED "max-age" directive specifies the number of seconds, 208 after the reception of the PKP header field, during which the UA 209 SHOULD regard the host (from whom the message was received) as a 210 Known Pinned Host. The delta-seconds production is specified in 211 [RFC2616]. 213 The syntax of the max-age directive's REQUIRED value (after quoted- 214 string unescaping, if necessary) is defined as: 216 max-age-value = delta-seconds 217 delta-seconds = 1*DIGIT 219 Figure 2: max-age Value Syntax 221 delta-seconds is used as defined in [RFC2616], Section 3.3.2. 223 NOTE: A max-age value of zero (i.e., "max-age=0") signals the UA to 224 cease regarding the host as a Known Pinned Host, including the 225 includeSubDomains directive (if asserted for that Known Pinned Host). 226 See Section 2.3.1. 228 2.1.2. The includeSubDomains Directive 230 The OPTIONAL "includeSubDomains" directive is a valueless directive 231 which, if present (i.e., it is "asserted"), signals to the UA that 232 the Pinning Policy applies to this Pinned Host as well as any 233 subdomains of the host's domain name. 235 2.1.3. The report-uri Directive 237 The OPTIONAL "report-uri" directive indicates the URI to which the UA 238 SHOULD report Pin Validation failures (Section 2.6). The UA POSTs 239 the reports to the given URI as described in Section 3. 241 When used in the Public-Key-Pins or Public-Key-Pins-Report-Only 242 header, the presence of a report-uri directive indicates to the UA 243 that in the event of Pin Validation failure it SHOULD POST a report 244 to the report-uri. If the header is Public-Key-Pins, the UA should 245 do this in addition to terminating the connection (as described in 246 Section 2.6). 248 Hosts may set report-uris that use HTTP, HTTPS, or other schemes. If 249 the scheme in the report-uri is HTTPS, UAs MUST perform Pinning 250 Validation when the host in the report-uri is a Known Pinned Host; 251 similarly, UAs MUST apply HSTS if the host in the report-uri is a 252 Known HSTS Host. 254 Note that the report-uri need not necessarily be in the same Internet 255 domain or web origin as the Known Pinned Host. 257 UAs SHOULD make their best effort to report Pin Validation failures 258 to the report-uri, but may fail to report in exceptional conditions. 259 For example, if connecting the report-uri itself incurs a Pinning 260 Validation failure or other certificate validation failure, the UA 261 MUST cancel the connection (and MAY attempt to re-send the report 262 later). Similarly, if Known Pinned Host A sets a report-uri 263 referring to Known Pinned Host B, and if B sets a report-uri 264 referring to A, and if both hosts fail Pin Validation, the UA SHOULD 265 detect and break the loop by failing to send reports to and about 266 those hosts. 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. 272 UAs MUST NOT send a report if the Host is not already a Known Pinned 273 Host. (I.e., the UA's first connection to a Host fails Pin 274 Validation.) The reason for this is so that a potential active 275 network attacker cannot learn about a UA's certificate validation and 276 Pin Validation procedures and state. 278 2.1.4. Examples 280 Figure 3 shows some example response header fields using the Pins 281 extension (folded for clarity). 283 Public-Key-Pins: max-age=3000; 284 pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM="; 285 pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; 287 Public-Key-Pins: max-age=2592000; 288 pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; 289 pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ=" 291 Public-Key-Pins: max-age=2592000; 292 pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; 293 pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; 294 report-uri="http://example.com/pkp-report" 296 Public-Key-Pins-Report-Only: max-age=2592000; 297 pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; 298 pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; 299 report-uri="http://example.com/pkp-report" 301 Public-Key-Pins: 302 pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM="; 303 pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; 304 max-age=259200 306 Public-Key-Pins: 307 pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM="; 308 pin-sha256="E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g="; 309 pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; 310 max-age=10000; includeSubDomains 312 Figure 3: HPKP Header Examples 314 2.2. Server Processing Model 316 This section describes the processing model that Pinned Hosts 317 implement. The model comprises two facets: the processing rules for 318 HTTP request messages received over a secure transport (e.g. TLS 319 [RFC5246]); and the processing rules for HTTP request messages 320 received over non-secure transports, such as TCP. 322 2.2.1. HTTP-over-Secure-Transport Request Type 324 When replying to an HTTP request that was conveyed over a secure 325 transport, a Pinned Host SHOULD include in its response exactly one 326 PKP header field that MUST satisfy the grammar specified above in 327 Section 2.1. 329 Establishing a given host as a Known Pinned Host, in the context of a 330 given UA, MAY be accomplished over the HTTP protocol, which is in 331 turn running over secure transport, by correctly returning (per this 332 specification) at least one valid PKP header field to the UA. Other 333 mechanisms, such as a client-side pre-loaded Known Pinned Host list 334 MAY also be used. 336 2.2.2. HTTP Request Type 338 Pinned Hosts SHOULD NOT include the PKP header field in HTTP 339 responses conveyed over non-secure transport. UAs MUST ignore any 340 PKP header received in an HTTP response conveyed over non-secure 341 transport. 343 2.3. User Agent Processing Model 345 This section describes the HTTP Public Key Pinning processing model 346 for UAs. 348 The UA processing model relies on parsing domain names. Note that 349 internationalized domain names SHALL be canonicalized according to 350 the scheme in Section 10 of [RFC6797]. 352 2.3.1. Public-Key-Pins Response Header Field Processing 354 If the UA receives, over a secure transport, an HTTP response that 355 includes a PKP header field conforming to the grammar specified in 356 Section 2.1, and there are no underlying secure transport errors or 357 warnings (see Section 2.5), the UA MUST either: 359 o Note the host as a Known Pinned Host if it is not already so noted 360 (see Section 2.3.3), 362 or, 364 o Update the UA's cached information for the Known Pinned Host if 365 any of of the max-age, includeSubDomains, or report-uri header 366 field value directives convey information different than that 367 already maintained by the UA. 369 o The max-age value is essentially a "time to live" value relative 370 to the time of the most recent observation of the PKP header 371 field. 373 o If the max-age header field value token has a value of 0, the UA 374 MUST remove its cached Pinning Policy information (including the 375 includeSubDomains directive, if asserted) if the Pinned Host is 376 Known, or, MUST NOT note this Pinned Host if it is not yet Known. 378 o If a UA receives more than one PKP header field in an HTTP 379 response message over secure transport, then the UA MUST process 380 only the first such header field. 382 Otherwise: 384 o If the UA receives the HTTP response over insecure transport, or 385 if the PKP header is not a Valid Pinning Header (see Section 2.5), 386 the UA MUST ignore any present PKP header field(s). 388 o The UA MUST ignore any PKP header fields not conforming to the 389 grammar specified in Section 2.1. 391 2.3.2. Interaction of Public-Key-Pins and Public-Key-Pins-Report-Only 393 A server MAY set both the Public-Key-Pins and Public-Key-Pins-Report- 394 Only headers simultaneously. The headers do not interact with one 395 another but the UA MUST process the Public-Key-Pins header and SHOULD 396 process both. 398 The Public-Key-Pins header is processed as according to 399 Section 2.3.1. 401 When the Public-Key-Pins-Report-Only header is used with a report- 402 uri, the UA SHOULD POST reports for Pin Validation failures to the 403 indicated report-uri, although the UA MUST NOT enforce Pin 404 Validation. That is, in the event of Pin Validation failure when the 405 host has set the Public-Key-Pins-Report-Only header, the UA performs 406 Pin Validation only to check whether or not it should POST a report, 407 but not for causing connection failure. 409 Note: There is no purpose to using the Public-Key-Pins-Report-Only 410 header without the report-uri directive. User Agents MAY discard 411 such headers without interpretting them further. 413 If a Host sets the Public-Key-Pins-Report-Only header, the UA SHOULD 414 note the Pins and directives given in the Public-Key-Pins-Report-Only 415 header as specified by the max-age directive. If the UA does note 416 the Pins and directives in the Public-Key-Pins-Report-Only header it 417 SHOULD evaluate the specified policy and SHOULD report any would-be 418 Pin Validation failures that would occur if the report-only policy 419 were enforced. 421 If a Host sets both the Public-Key-Pins header and the Public-Key- 422 Pins-Report-Only header, the UA MUST note and enforce Pin Validation 423 as specified by the Public-Key-Pins header, and SHOULD note the Pins 424 and directives given in the Public-Key-Pins-Report-Only header. If 425 the UA does note the Pins and directives in the Public-Key-Pins- 426 Report-Only header it SHOULD evaluate the specified policy and SHOULD 427 report any would-be Pin Validation failures that would occur if the 428 report-only policy were enforced. 430 2.3.3. Noting a Pinned Host - Storage Model 432 The Effective Pin Date of a Known Pinned Host is the time that the UA 433 observed a Valid Pinning Header for the host. The Effective 434 Expiration Date of a Known Pinned Host is the Effective Pin Date plus 435 the max-age. A Known Pinned Host is "expired" if the Effective 436 Expiration Date refers to a date in the past. The UA MUST ignore all 437 expired Known Pinned Hosts from its cache if, at any time, an expired 438 Known Pinned Host exists in the cache. 440 If the substring matching the host production from the Request-URI 441 (of the message to which the host responded) syntactically matches 442 the IP-literal or IPv4address productions from Section 3.2.2 of 443 [RFC3986], then the UA MUST NOT note this host as a Known Pinned 444 Host. 446 Otherwise, if the substring does not congruently match a Known Pinned 447 Host's domain name, per the matching procedure specified in 448 Section 8.2 of [RFC6797], then the UA MUST note this host as a Known 449 Pinned Host, caching the Pinned Host's domain name and noting along 450 with it the Effective Expiration Date (or enough information to 451 calculate it, i.e. the Effective Pin Date and the value of the max- 452 age directive), whether or not the includeSubDomains directive is 453 asserted, the value of the report-uri directive (if present). If any 454 other metadata from optional or future PKP header directives is 455 present in the Valid Pinning Header, the UA MAY note them if it 456 understands them, and need not note them if it does not understand 457 them. 459 UAs MAY set an upper limit on the value of max-age, so that UAs that 460 have noted erroneous Pins (whether by accident or due to attack) have 461 some chance of recovering over time. If the server sets a max-age 462 greater than the UA's upper limit, the UA MAY behave as if the server 463 set the max-age to the UA's upper limit. For example, if the UA caps 464 max-age at 5184000 seconds (60 days), and a Pinned Host sets a max- 465 age directive of 90 days in its Valid Pinning Header, the UA MAY 466 behave as if the max-age were effectively 60 days. (One way to 467 achieve this behavior is for the UA to simply store a value of 60 468 days instead of the 90 day value provided by the Pinned Host.) For 469 UA implementation guidance on how to select a maximum max-age, see 470 Section 4.1. 472 The UA MUST NOT modify any pinning metadata of any superdomain 473 matched Known Pinned Host. 475 2.3.4. HTTP-Equiv Element Attribute 477 UAs MUST NOT heed http-equiv="Public-Key-Pins" or http-equiv="Public- 478 Key-Pins-Report-Only" attribute settings on elements 479 [W3C.REC-html401-19991224] in received content. 481 2.4. Semantics of Pins 483 An SPKI Fingerprint is defined as the output of a known cryptographic 484 hash algorithm whose input is the DER-encoded ASN.1 representation of 485 the SubjectPublicKeyInfo (SPKI) field of an X.509 certificate. A Pin 486 is defined as the combination of the known algorithm identifier and 487 the SPKI Fingerprint computed using that algorithm. 489 The SPKI Fingerprint is encoded in base 64 for use in an HTTP header. 490 (See [RFC4648].) 492 In this version of the specification, the known cryptographic hash 493 algorithm is SHA-256, identified as "sha256" ([RFC4634]). (Future 494 versions of this specification may add new algorithms and deprecate 495 old ones.) UAs MUST ignore Pins for which they do not recognize the 496 algorithm identifier. UAs MUST continue to process the rest of a PKP 497 response header field and note Pins for algorithms they do recognize; 498 UAs MUST recognize "sha256". 500 Figure 4 reproduces the definition of the SubjectPublicKeyInfo 501 structure in [RFC5280]. 503 SubjectPublicKeyInfo ::= SEQUENCE { 504 algorithm AlgorithmIdentifier, 505 subjectPublicKey BIT STRING } 507 AlgorithmIdentifier ::= SEQUENCE { 508 algorithm OBJECT IDENTIFIER, 509 parameters ANY DEFINED BY algorithm OPTIONAL } 511 Figure 4: SPKI Definition 513 If the SubjectPublicKeyInfo of a certificate is incomplete when taken 514 in isolation, such as when holding a DSA key without domain 515 parameters, a public key pin cannot be formed. 517 We pin public keys, rather than entire certificates, to enable 518 operators to generate new certificates containing old public keys 519 (see [why-pin-key]). 521 See Appendix A for an example non-normative program that generates 522 SPKI Fingerprints from SubjectPublicKeyInfo fields in certificates. 524 2.5. Noting Pins 526 Upon receipt of the Public-Key-Pins response header field, the UA 527 notes the host as a Pinned Host, storing the Pins and their 528 associated directives in non-volatile storage (for example, along 529 with the HSTS metadata). The Pins and their associated directives 530 are collectively known as Pinning Metadata. 532 The UA MUST observe these conditions when noting a Host: 534 o The UA MUST note the Pins if and only if it received the Public- 535 Key-Pins response header field over an error-free TLS connection. 536 If the host is a Pinned Host, this includes the validation added 537 in Section 2.6. 539 o The UA MUST note the Pins if and only if the TLS connection was 540 authenticated with a certificate chain containing at least one of 541 the SPKI structures indicated by at least one of the given SPKI 542 Fingerprints. (See Section 2.6.) 544 o The UA MUST note the Pins if and only if the given set of Pins 545 contains at least one Pin that does NOT refer to an SPKI in the 546 certificate chain. (That is, the host must set a Backup Pin; see 547 Section 4.3.) 549 If the Public-Key-Pins response header field does not meet all three 550 of these criteria, the UA MUST NOT note the host as a Pinned Host. A 551 Public-Key-Pins response header field that meets all these critera is 552 known as a Valid Pinning Header. 554 Whenever a UA receives a Valid Pinning Header, it MUST set its 555 Pinning Metadata to the exact Pins, max-age, and (if any) report-uri 556 given in the most recently received Valid Pinning Header. 558 For forward compatibility, the UA MUST ignore any unrecognized 559 Public-Key-Pins header directives, while still processing those 560 directives it does recognize. Section 2.1 specifies the directives 561 max-age, Pins, includeSubDomains, and report-uri but future 562 specifications and implementations might use additional directives. 564 2.6. Validating Pinned Connections 566 When a UA connects to a Pinned Host, if the TLS connection has 567 errors, the UA MUST terminate the connection without allowing the 568 user to proceed anyway. (This behavior is the same as that required 569 by [RFC6797].) 570 If the connection has no errors, then the UA will determine whether 571 to apply a new, additional correctness check: Pin Validation. A UA 572 SHOULD perform Pin Validation whenever connecting to a Known Pinned 573 Host, but MAY allow Pin Validation to be disabled for Hosts according 574 to local policy. For example, a UA may disable Pin Validation for 575 Pinned Hosts whose validated certificate chain terminates at a user- 576 defined trust anchor, rather than a trust anchor built-in to the UA. 578 To perform Pin Validation, the UA will compute the SPKI Fingerprints 579 for each certificate in the Pinned Host's validated certificate 580 chain, using each supported hash algorithm for each certificate. 581 (For the purposes of Pin Validation, the UA MUST ignore certificates 582 whose SPKI cannot be taken in isolation, and MUST ignore superfluous 583 certificates in the chain that do not form part of the validating 584 chain.) The UA will then check that the set of these SPKI 585 Fingerprints intersects the set of SPKI Fingerprints in that Pinned 586 Host's Pinning Metadata. If there is set intersection, the UA 587 continues with the connection as normal. Otherwise, the UA MUST 588 treat this Pin Failure as a non-recoverable error. Any procedure 589 that matches the results of this Pin Validation procedure is 590 considered equivalent. 592 Note that, although the UA has previously received Pins at the HTTP 593 layer, it can and MUST perform Pin Validation at the TLS layer, 594 before beginning an HTTP conversation over the TLS channel. The TLS 595 layer thus evaluates TLS connections with pinning information the UA 596 received previously, regardless of mechanism: statically preloaded, 597 via HTTP header, or some other means (possibly in the TLS layer 598 itself). 600 2.7. Interactions With Preloaded Pin Lists 602 UAs MAY choose to implement additional sources of pinning 603 information, such as through built-in lists of pinning information. 604 Such UAs SHOULD allow users to override such additional sources, 605 including disabling them from consideration. 607 UAs that support additional sources of pinning information MUST use 608 the most recently observed pinning information when performing Pin 609 Validation for a host. The most recently observed pinning 610 information is determined based upon the most recent Effective Pin 611 Date, as described in Section 2.3.3. The Effective Pin Date of 612 built-in pin lists is UA implementation-defined. 614 If the result of noting a Valid Pinning Header is to disable pinning 615 for the host, such as through supplying a max-age directive with a 616 value of 0, UAs MUST allow this new information to override any other 617 pinning data. That is, a host must be able to un-pin itself, even in 618 the presence of built-in Pins. 620 Example: A UA may ship with a pre-configured list of Pins that are 621 collected from past observations of Valid Pinning Headers supplied by 622 hosts. In such a solution, the pre-configured list should track when 623 the Valid Pinning Header was last observed, in order to permit site 624 operators to later update the value by supplying a new Valid Pinning 625 Header. Updates to such a pre-configured list should not update the 626 Effective Pin Dates for each host unless the list vendor has actually 627 observed a more recent header. This is to prevent situations where 628 updating the Effective Pin Date on a pre-configured list of Pins may 629 effectively extend the max-age beyond the site operator's stated 630 policy. 632 Example: A UA may ship with a pre-configured list of Pins that are 633 collected through out-of-band means, such as direct contact with the 634 site operator. In such a solution, the site operator accepts 635 responsibility for keeping the configured Valid Pinning Header in 636 sync with the vendor's list, allowing the UA vendor to have each 637 update to the list be treated as as an update of the Effective Pin 638 Date. 640 2.8. Pinning Self-Signed End Entities 642 If UAs accept hosts that authenticate themselves with self-signed end 643 entity certificates, they MAY also allow hosts to pin the public keys 644 in such certificates. The usability and security implications of 645 this practice are outside the scope of this specification. 647 3. Reporting Pin Validation Failure 649 When a Known Pinned Host has set the report-uri directive, the UA 650 SHOULD report Pin Validation failures to the indicated URI. The UA 651 does this by POSTing a JSON ([RFC4627]) message to the URI; the JSON 652 message takes this form: 654 { 655 "date-time": date-time, 656 "hostname": hostname, 657 "port": port, 658 "effective-expiration-date": expiration-date, 659 "include-subdomains": include-subdomains, 660 "served-certificate-chain": [ 661 pem1, ... pemN 662 ], 663 "validated-certificate-chain": [ 664 pem1, ... pemN 665 ], 666 "known-pins": [ 667 known-pin1, ... known-pinN 668 ] 669 } 671 Figure 5: JSON Report Format 673 Whitespace outside of quoted strings is not significant. The key/ 674 value pairs may appear in any order, but each SHOULD appear only 675 once. 677 The date-time indicates the time the UA observed the Pin Validation 678 failure. It is provided as a string formatted according to 679 Section 5.6, "Internet Date/Time Format", of [RFC3339]. 681 The hostname is the hostname to which the UA made the original 682 request that failed Pin Validation. It is provided as a string. 684 The port is the port to which the UA made the original request that 685 failed Pin Validation. It is provided either as a string or as an 686 integer. 688 The effective-expiration-date is the Effective Expiration Date for 689 the noted Pins. It is provided as a string formatted according to 690 Section 5.6, "Internet Date/Time Format", of [RFC3339]. 692 include-subdomains indicates whether or not the UA has noted the 693 includeSubDomains directive for the Known Pinned Host. It is 694 provided as one of the JSON identifiers true or false. 696 The served-certificate-chain is the certificate chain, as served by 697 the Known Pinned Host during TLS session setup. It is provided as an 698 array of strings; each string pem1, ... pemN is the PEM 699 representation of each X.509 certificate as described in 700 [I-D.josefsson-pkix-textual]. 702 The validated-certificate-chain is the certificate chain, as 703 constructed by the UA during certificate chain verification. (This 704 may differ from the served-certificate-chain.) It is provided as an 705 array of strings; each string pem1, ... pemN is the PEM 706 representation of each X.509 certificate as described in 707 [I-D.josefsson-pkix-textual]. For UAs that build certificate chains 708 in more than one way during the validation process, they SHOULD send 709 the last chain built. In this way they can avoid keeping too much 710 state during the validation process. 712 The known-pins are the Pins that the UA has noted for the Known 713 Pinned Host. They are provided as an array of strings with the 714 syntax: 716 known-pin = token "=" quoted-string 718 Figure 6: Known Pin Syntax 720 As in Section 2.4, the token refers to the algorithm name, and the 721 quoted-string refers to the base 64 encoding of the SPKI Fingerprint. 722 When formulating the JSON POST body, the UA MUST either use single- 723 quoted JSON strings, or use double-quoted JSON strings and \-escape 724 the embedded double quotes in the quoted-string part of the known- 725 pin. 727 Figure 7 shows an example of a Pin Validation failure report. (PEM 728 strings are shown on multiple lines for readability in this 729 document.) 731 { 732 "date-time": "2014-04-06T13:00:50Z", 733 "hostname": "www.example.com", 734 "port": 443, 735 "effective-expiration-date": "2014-05-01T12:40:50Z" 736 "include-subdomains": false, 737 "served-certificate-chain": [ 738 "-----BEGIN CERTIFICATE-----\n 739 MIIEBDCCAuygAwIBAgIDAjppMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT\n 740 ... 741 HFa9llF7b1cq26KqltyMdMKVvvBulRP/F/A8rLIQjcxz++iPAsbw+zOzlTvjwsto\n 742 WHPbqCRiOwY1nQ2pM714A5AuTHhdUDqB1O6gyHA43LL5Z/qHQF1hwFGPa4NrzQU6\n 743 yuGnBXj8ytqU0CwIPX4WecigUCAkVDNx\n 744 -----END CERTIFICATE-----", 745 ... 746 ], 747 "validated-certificate-chain": [ 748 "-----BEGIN CERTIFICATE-----\n 749 MIIEBDCCAuygAwIBAgIDAjppMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT\n 750 ... 751 HFa9llF7b1cq26KqltyMdMKVvvBulRP/F/A8rLIQjcxz++iPAsbw+zOzlTvjwsto\n 752 WHPbqCRiOwY1nQ2pM714A5AuTHhdUDqB1O6gyHA43LL5Z/qHQF1hwFGPa4NrzQU6\n 753 yuGnBXj8ytqU0CwIPX4WecigUCAkVDNx\n 754 -----END CERTIFICATE-----", 755 ... 756 ], 757 "known-pins": [ 758 'pin-sha256="d6qzRu9zOECb90Uez27xWltNsj0e1Md7GkYYkVoZWmM="', 759 "pin-sha256=\"E9CZ9INDbd+2eRQozYqqbQ2yXLVKB9+xcprMF+44U1g=\"" 760 ] 761 } 763 Figure 7: Pin Validation Failure Report Example 765 4. Security Considerations 767 Pinning public keys helps hosts strongly assert their cryptographic 768 identity even in the face of issuer error, malfeasance or compromise. 769 But there is some risk that a host operator could lose or lose 770 control of their host's private key (such as by operator error or 771 host compromise). If the operator had pinned only the key of the 772 host's end entity certificate, the operator would not be able to 773 serve their web site or application in a way that UAs would trust for 774 the duration of their pin's max-age. (Recall that UAs MUST close the 775 connection to a host upon Pin Failure.) 777 Therefore, there is a necessary trade-off between two competing 778 goods: pin specificity and maximal reduction of the scope of issuers 779 on the one hand; and flexibility and resilience of the host's 780 cryptographic identity on the other hand. One way to resolve this 781 trade-off is to compromise by pinning to the key(s) of the issuer(s) 782 of the host's end entity certificate(s). Often, a valid certificate 783 chain will have at least two certificates above the end entity 784 certificate: the intermediate issuer, and the trust anchor. 785 Operators can pin any one or more of the public keys in this chain, 786 and indeed could pin to issuers not in the chain (as, for example, a 787 Backup Pin). Pinning to an intermediate issuer, or even to a trust 788 anchor or root, still significantly reduces the number of issuers who 789 can issue end entity certificates for the Known Pinned Host, while 790 still giving that host flexibility to change keys without a 791 disruption of service. 793 4.1. Maximum max-age 795 As mentioned in Section 2.3.3, UAs MAY cap the max-age value at some 796 upper limit. There is a security trade-off in that low maximum 797 values provide a narrow window of protection for users who visit the 798 Known Pinned Host only infrequently, while high maximum values might 799 potentially result in a UA's inability to successfully perform Pin 800 Validation for a Known Pinned Host if the UA's noted Pins and the 801 Host's true Pins diverge. 803 Such divergence could occur for several reasons, including: UA error; 804 Host operator error; network attack; or a Known Pinned Host that 805 intentionally migrates all pinned keys, combined with a UA that has 806 noted true Pins with a high max-age value and has not had a chance to 807 observe the new true Pins for the Host. (This last example 808 underscores the importance for Host operators to phase in new keys 809 gradually, and to set the max-age value in accordance with their 810 planned key migration schedule.) 812 There is probably no ideal upper limit to the max-age directive that 813 would satisfy all use cases. However, a value on the order of 60 814 days (5184000 seconds) may be considered a balance between the two 815 competing security concerns. 817 4.2. Using includeSubDomains Safely 819 It may happen that Pinned Hosts whose hostnames share a parent domain 820 use different Valid Pinning Headers. If a Host whose hostname is a 821 parent domain for another Host sets the includeSubDomains directive, 822 the two Hosts' Pins may conflict with each other. For example, 823 consider two Known Pinned Hosts, example.com and 824 subdomain.example.com. Assume example.com sets a Valid Pinning 825 Header such as this: 827 Public-Key-Pins: max-age=12000; pin-sha256="ABC..."; pin-sha256="DEF..."; 828 includeSubDomains 830 Figure 8: example.com Valid Pinning Header 832 Assume subdomain.example.com sets a Valid Pinning Header such as 833 this: 835 Public-Key-Pins: pin-sha256="GHI..."; pin-sha256="JKL..." 837 Figure 9: subdomain.example.com Valid Pinning Header 839 Assume a UA that has not previously noted any Pins for either of 840 these Hosts. If the UA first contacts subdomain.example.com, it will 841 note the Pins in the Valid Pinning Header, and perform Pin Validation 842 as normal on subsequent conections. If the UA then contacts 843 example.com, again it will note the Pins and perform Pin Validation 844 on future connections. However, if the UA happened to first 845 example.com before subdomain.example.com, the UA would, due to 846 example.com's use of the includeSubDomains directive, attempt to 847 perform Pin Validation for subdomain.example.com using the SPKI 848 hashes ABC... and DEF..., which are not valid for the certificate 849 chains subdomain.example.com (which uses certificates with SPKIs 850 GHI... and JLK...). Thus, depending on the order in which the UA 851 observes the Valid Pinning Headers for hosts example.com and 852 subdomain.example.com, Pin Validation might or might not fail for 853 subdomain.example.com, even if the certificate chain the UA receives 854 for subdomain.example.com is perfectly valid. 856 Thus, Pinned Host operators must use the includeSubDomains directive 857 with care. For example, they may choose to use overlapping pin sets 858 for hosts under a parent domain that uses includeSubDomains, or to 859 not use the includeSubDomains directive in their effective-second- 860 level domains, or to simply use the same pin set for all hosts under 861 a given parent domain. 863 4.3. Backup Pins 865 The primary way to cope with the risk of inadvertent Pin Failure is 866 to keep a Backup Pin. A Backup Pin is a fingerprint for the public 867 key of a secondary, not-yet-deployed key pair. The operator keeps 868 the backup key pair offline, and sets a pin for it in the Public-Key- 869 Pins header. Then, in case the operator loses control of their 870 primary private key, they can deploy the backup key pair. UAs, who 871 have had the backup key pair pinned (when it was set in previous 872 Valid Pinning Headers), can connect to the host without error. 874 Because having a backup key pair is so important to recovery, UAs 875 MUST require that hosts set a Backup Pin. (See Section 2.5.) 877 5. Privacy Considerations 879 Conforming implementations (as well as implementations conforming to 880 [RFC6797]) must store state about which domains have set policies, 881 hence which domains the UA has contacted. A forensic attacker might 882 find this information useful, even if the user has cleared other 883 parts of the UA's state. 885 More importantly, Hosts can use HSTS or HPKP as a "super-cookie", by 886 setting distinct policies for a number of subdomains. For example, 887 assume example.com wishes to track distinct UAs without explicitly 888 setting a cookie, or if a previously-set cookie is deleted from the 889 UA's cookie store. Here are two attack scenarios. 891 o example.com can use report-uri and the ability to pin arbitrary 892 identifiers to distinguish UAs. 894 1. example.com sets a Valid Pinning Header in its response to 895 requests. The header asserts the includeSubDomains directive, 896 and specifies a report-uri directive as well. Pages served by 897 the host also include references to subresource https:// 898 bad.example.com/foo.png. 900 2. The Valid Pinning Header includes a "pin" that is not really 901 the hash of an SPKI, but is instead an arbitrary 902 distinguishing string sent only in response to a particular 903 request. For each request, the Host creates a new, distinct 904 distinguishing string and sets it as if it were a pin. 906 3. The certificate chain served by bad.example.com does not pass 907 Pin Validation given the pin set the Host asserted in (1). 908 The HPKP-conforming UA attempts to report the Pin Validation 909 failure to the specified report-uri, including the certificate 910 chain it observed and the SPKI hashes it expected to see. 911 Among the SPKI hashes is the distinguishing string in step 912 (2). 914 o example.com can use SNI and subdomains to distinguish UAs. 916 1. example.com sets a Valid Pinning Header in its response to 917 requests. The header asserts the includeSubDomains directive. 919 2. On a subsequent page view, the Host responds with a page 920 including the subresource https://0.fingerprint.example.com/ 921 foo.png, and the server responds using a certificate chain 922 that does not pass Pin Validation for the pin-set defined in 923 the Valid Pinning Header in step (1). The HPKP-conforming UA 924 will close the connection, never completing the request to 925 0.fingerprint.example.com. The Host may thus note that this 926 particular UA had noted the (good) Pins for that subdomain. 928 3. example.com can distinguish 2^N UAs by serving Valid Pinning 929 Headers from an arbitrary number N distinct subdomains, giving 930 some UAs Valid Pinning Headers for some, but not all 931 subdomains (causing subsequent requests for 932 n.fingerprint.example.com to fail), and giving some UAs no 933 Valid Pinning Header for other subdomains (causing subsequent 934 requests for m.fingerprint.example.com to succeed). 936 6. IANA Considerations 938 IANA is requested to register the header described in this document 939 in the "Message Headers" registry, with the following parameters: 941 o Header Field Names should be "Public-Key-Pins" and "Public-Key- 942 Pins-Report-Only". 944 o Protocol should be "http" 946 o Status should be "standard" 948 o Reference should be this document 950 7. Usability Considerations 952 When pinning works to detect impostor Pinned Hosts, users will 953 experience denial of service. UAs MUST explain the reason why, i.e. 954 that it was impossible to verify the confirmed cryptographic identity 955 of the host. 957 UAs MUST have a way for users to clear current Pins for Pinned Hosts. 958 UAs SHOULD have a way for users to query the current state of Pinned 959 Hosts. 961 8. Acknowledgements 963 Thanks to Tobias Gondrom, Jeff Hodges, Paul Hoffman, Ivan Krstic, 964 Adam Langley, Nicolas Lidzborski, SM, James Manger, Yoav Nir, Eric 965 Rescorla, and Tom Ritter for suggestions and edits that clarified the 966 text. Thanks to Trevor Perrin for suggesting a mechanism to 967 affirmatively break Pins ([pin-break-codes]). 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 1012 10.1. Normative References 1014 [I-D.josefsson-pkix-textual] 1015 Josefsson, S. and S. Leonard, "Text Encodings of PKIX and 1016 CMS Structures", draft-josefsson-pkix-textual-02 (work in 1017 progress), October 2013. 1019 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1020 Requirement Levels", BCP 14, RFC 2119, March 1997. 1022 [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., 1023 Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext 1024 Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999. 1026 [RFC3339] Klyne, G., Ed. and C. Newman, "Date and Time on the 1027 Internet: Timestamps", RFC 3339, July 2002. 1029 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 1030 Resource Identifier (URI): Generic Syntax", STD 66, RFC 1031 3986, January 2005. 1033 [RFC4627] Crockford, D., "The application/json Media Type for 1034 JavaScript Object Notation (JSON)", RFC 4627, July 2006. 1036 [RFC4634] Eastlake, D. and T. Hansen, "US Secure Hash Algorithms 1037 (SHA and HMAC-SHA)", RFC 4634, July 2006. 1039 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 1040 Encodings", RFC 4648, October 2006. 1042 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 1043 Encodings", RFC 4648, October 2006. 1045 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 1046 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 1047 May 2008. 1049 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 1050 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 1052 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 1053 Housley, R., and W. Polk, "Internet X.509 Public Key 1054 Infrastructure Certificate and Certificate Revocation List 1055 (CRL) Profile", RFC 5280, May 2008. 1057 [RFC6797] Hodges, J., Jackson, C., and A. Barth, "HTTP Strict 1058 Transport Security (HSTS)", RFC 6797, November 2012. 1060 [W3C.REC-html401-19991224] 1061 Raggett, D., Hors, A., and I. Jacobs, "HTML 4.01 1062 Specification", World Wide Web Consortium Recommendation 1063 REC-html401-19991224, December 1999, 1064 . 1066 10.2. Informative References 1068 [I-D.perrin-tls-tack] 1069 Marlinspike, M., "Trust Assertions for Certificate Keys", 1070 draft-perrin-tls-tack-02 (work in progress), January 2013. 1072 [pin-break-codes] 1073 Perrin, T., "Self-Asserted Key Pinning", September 2011, 1074 . 1076 [why-pin-key] 1077 Langley, A., "Public Key Pinning", May 2011, 1078 . 1080 Appendix A. Fingerprint Generation 1082 This POSIX shell program generates SPKI Fingerprints, suitable for 1083 use in pinning, from PEM-encoded certificates. It is non-normative. 1085 openssl x509 -noout -in certificate.pem -pubkey | \ 1086 openssl asn1parse -noout -inform pem -out public.key 1087 openssl dgst -sha256 -binary public.key | base64 1089 Figure 10: Example SPKI Fingerprint Generation Code 1091 Appendix B. Deployment Guidance 1093 This section is non-normative guidance which may smooth the adoption 1094 of public key pinning. 1096 o Operators SHOULD get the backup public key signed by a different 1097 (root and/or intermediary) CA than their primary certificate, and 1098 store the backup key pair safely offline. The semantics of an 1099 SPKI Fingerprint do not require the issuance of a certificate to 1100 construct a valid Pin. However, in many deployment scenarios, in 1101 order to make a Backup Pin operational the server operator will 1102 need to have a certificate to deploy TLS on the host. Failure to 1103 obtain a certificate through prior arrangement will leave clients 1104 that recognize the site as a Known Pinned Host unable to 1105 successfully perform Pin Validation until such a time as the 1106 operator can obtain a new certificate from their desired 1107 certificate issuer. 1109 o It is most economical to have the backup certificate signed by a 1110 completely different signature chain than the live certificate, to 1111 maximize recoverability in the event of either root or 1112 intermediary signer compromise. 1114 o Operators SHOULD periodically exercise their Backup Pin plan -- an 1115 untested backup is no backup at all. 1117 o Operators SHOULD start small. Operators SHOULD first deploy 1118 public key pinning by using the report-only mode together with a 1119 report-uri directive that points to a reliable report collection 1120 endpoint. When moving out of report-only mode, operators should 1121 start by setting a max-age of minutes or a few hours, and 1122 gradually increase max-age as they gain confidence in their 1123 operational capability. 1125 Authors' Addresses 1127 Chris Evans 1128 Google, Inc. 1129 1600 Amphitheatre Pkwy 1130 Mountain View, CA 94043 1131 US 1133 Email: cevans@google.com 1135 Chris Palmer 1136 Google, Inc. 1137 1600 Amphitheatre Pkwy 1138 Mountain View, CA 94043 1139 US 1141 Email: palmer@google.com 1143 Ryan Sleevi 1144 Google, Inc. 1145 1600 Amphitheatre Pkwy 1146 Mountain View, CA 94043 1147 US 1149 Email: sleevi@google.com