draft-ietf-websec-key-pinning-05.txt   draft-ietf-websec-key-pinning-06.txt 
Web Security C. Evans Web Security C. Evans
Internet-Draft C. Palmer Internet-Draft C. Palmer
Intended status: Standards Track R. Sleevi Intended status: Standards Track R. Sleevi
Expires: December 09, 2013 Google, Inc. Expires: December 21, 2013 Google, Inc.
June 07, 2013 June 19, 2013
Public Key Pinning Extension for HTTP Public Key Pinning Extension for HTTP
draft-ietf-websec-key-pinning-05 draft-ietf-websec-key-pinning-06
Abstract Abstract
This memo describes an extension to the HTTP protocol allowing web This memo describes an extension to the HTTP protocol allowing web
host operators to instruct user agents (UAs) to remember ("pin") the host operators to instruct user agents (UAs) to remember ("pin") the
hosts' cryptographic identities for a given period of time. During hosts' cryptographic identities for a given period of time. During
that time, UAs will require that the host present a certificate chain that time, UAs will require that the host present a certificate chain
including at least one Subject Public Key Info structure whose including at least one Subject Public Key Info structure whose
fingerprint matches one of the pinned fingerprints for that host. By fingerprint matches one of the pinned fingerprints for that host. By
effectively reducing the number of authorities who can authenticate effectively reducing the number of authorities who can authenticate
skipping to change at page 1, line 40 skipping to change at page 1, line 40
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/. Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on December 09, 2013. This Internet-Draft will expire on December 21, 2013.
Copyright Notice Copyright Notice
Copyright (c) 2013 IETF Trust and the persons identified as the Copyright (c) 2013 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1. Requirements Language . . . . . . . . . . . . . . . . . . 3 1.1. Requirements Language . . . . . . . . . . . . . . . . . . 3
2. Server and Client Behavior . . . . . . . . . . . . . . . . . 3 2. Server and Client Behavior . . . . . . . . . . . . . . . . . 3
2.1. Response Header Field Syntax . . . . . . . . . . . . . . 3 2.1. Response Header Field Syntax . . . . . . . . . . . . . . 3
2.1.1. The max-age Directive . . . . . . . . . . . . . . . . 5 2.1.1. The max-age Directive . . . . . . . . . . . . . . . . 5
2.1.2. The includeSubDomains Directive . . . . . . . . . . . 5 2.1.2. The includeSubDomains Directive . . . . . . . . . . . 5
2.1.3. The report-uri Directive . . . . . . . . . . . . . . 5 2.1.3. The report-uri Directive . . . . . . . . . . . . . . 5
2.1.4. The strict Directive . . . . . . . . . . . . . . . . 6 2.1.4. The strict Directive . . . . . . . . . . . . . . . . 6
2.1.5. Examples . . . . . . . . . . . . . . . . . . . . . . 6 2.1.5. Examples . . . . . . . . . . . . . . . . . . . . . . 6
2.2. Server Processing Model . . . . . . . . . . . . . . . . . 7 2.2. Server Processing Model . . . . . . . . . . . . . . . . . 7
2.2.1. HTTP-over-Secure-Transport Request Type . . . . . . . 7 2.2.1. HTTP-over-Secure-Transport Request Type . . . . . . . 7
2.2.2. HTTP Request Type . . . . . . . . . . . . . . . . . . 7 2.2.2. HTTP Request Type . . . . . . . . . . . . . . . . . . 7
2.3. User Agent Processing Model . . . . . . . . . . . . . . . 8 2.3. User Agent Processing Model . . . . . . . . . . . . . . . 8
2.3.1. Public-Key-Pins Response Header Field Processing . . 8 2.3.1. Public-Key-Pins Response Header Field Processing . . 8
2.3.2. Noting a Pinned Host - Storage Model . . . . . . . . 9 2.3.2. Noting a Pinned Host - Storage Model . . . . . . . . 9
2.3.3. HTTP-Equiv <Meta> Element Attribute . . . . . . . . . 9 2.3.3. HTTP-Equiv <Meta> Element Attribute . . . . . . . . . 9
2.3.4. UA Processing Examples . . . . . . . . . . . . . . . 9
2.4. Semantics of Pins . . . . . . . . . . . . . . . . . . . . 10 2.4. Semantics of Pins . . . . . . . . . . . . . . . . . . . . 10
2.5. Noting Pins . . . . . . . . . . . . . . . . . . . . . . . 11 2.5. Noting Pins . . . . . . . . . . . . . . . . . . . . . . . 10
2.6. Validating Pinned Connections . . . . . . . . . . . . . . 11 2.6. Validating Pinned Connections . . . . . . . . . . . . . . 11
2.7. Interactions With Preloaded Pin Lists . . . . . . . . . . 12 2.7. Interactions With Preloaded Pin Lists . . . . . . . . . . 12
2.8. Pinning Self-Signed End Entities . . . . . . . . . . . . 13 2.8. Pinning Self-Signed End Entities . . . . . . . . . . . . 13
3. Reporting Pin Validation Failure . . . . . . . . . . . . . . 13 3. Reporting Pin Validation Failure . . . . . . . . . . . . . . 13
4. Security Considerations . . . . . . . . . . . . . . . . . . . 14 4. Security Considerations . . . . . . . . . . . . . . . . . . . 14
4.1. Maximum max-age . . . . . . . . . . . . . . . . . . . . . 15 4.1. Maximum max-age . . . . . . . . . . . . . . . . . . . . . 15
4.2. Using includeSubdomains Safely . . . . . . . . . . . . . 16 4.2. Using includeSubDomains Safely . . . . . . . . . . . . . 15
4.3. Backup Pins . . . . . . . . . . . . . . . . . . . . . . . 16 4.3. Backup Pins . . . . . . . . . . . . . . . . . . . . . . . 17
5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 17 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 17
6. Usability Considerations . . . . . . . . . . . . . . . . . . 17 6. Usability Considerations . . . . . . . . . . . . . . . . . . 17
7. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 17 7. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 17
8. What's Changed . . . . . . . . . . . . . . . . . . . . . . . 17 8. What's Changed . . . . . . . . . . . . . . . . . . . . . . . 17
9. References . . . . . . . . . . . . . . . . . . . . . . . . . 18 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 18
9.1. Normative References . . . . . . . . . . . . . . . . . . 18 9.1. Normative References . . . . . . . . . . . . . . . . . . 18
9.2. Informative References . . . . . . . . . . . . . . . . . 19 9.2. Informative References . . . . . . . . . . . . . . . . . 19
Appendix A. Fingerprint Generation . . . . . . . . . . . . . . . 19 Appendix A. Fingerprint Generation . . . . . . . . . . . . . . . 19
Appendix B. Deployment Guidance . . . . . . . . . . . . . . . . 20 Appendix B. Deployment Guidance . . . . . . . . . . . . . . . . 19
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 21 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 20
1. Introduction 1. Introduction
We propose a new HTTP header to enable a web host to express to user We propose a new HTTP header to enable a web host to express to user
agents (UAs) which Subject Public Key Info (SPKI) structure(s) UAs agents (UAs) which Subject Public Key Info (SPKI) structure(s) UAs
SHOULD expect to be present in the host's certificate chain in future SHOULD expect to be present in the host's certificate chain in future
connections using TLS (see [RFC5246]). We call this "public key connections using TLS (see [RFC5246]). We call this "public key
pinning". At least one UA (Google Chrome) has experimented with pinning". At least one UA (Google Chrome) has experimented with the
shipping with a user-extensible embedded set of pins. Although idea by shipping with a user-extensible embedded set of pins.
effective, this does not scale. This proposal addresses the scale Although effective, this does not scale. This proposal addresses the
problem. scale problem.
Deploying public key pinning safely will require operational and Deploying public key pinning safely will require operational and
organizational maturity due to the risk that hosts may make organizational maturity due to the risk that hosts may make
themselves unavailable by pinning to a SPKI that becomes invalid. themselves unavailable by pinning to a SPKI that becomes invalid.
(See Section 4.) We believe that, with care, host operators can (See Section 4.) We believe that, with care, host operators can
greatly reduce the risk of MITM attacks and other false- greatly reduce the risk of MITM attacks and other false-
authentication problems for their users without incurring undue risk. authentication problems for their users without incurring undue risk.
We intend for hosts to use public key pinning together with HSTS We intend for hosts to use public key pinning together with HSTS
([RFC6797]), but is possible to pin keys without requiring HSTS. ([RFC6797]), but is possible to pin keys without requiring HSTS.
skipping to change at page 6, line 42 skipping to change at page 6, line 37
detect and break the loop by failing to send reports to and about detect and break the loop by failing to send reports to and about
those hosts. those hosts.
UAs SHOULD limit the rate at which they send reports. For example, UAs SHOULD limit the rate at which they send reports. For example,
it is unnecessary to send the same report to the same report-uri more it is unnecessary to send the same report to the same report-uri more
than once. than once.
2.1.4. The strict Directive 2.1.4. The strict Directive
The OPTIONAL "strict" directive is a valueless directive which, if The OPTIONAL "strict" directive is a valueless directive which, if
present (i.e., it is "asserted"), signals to the UA that the Pinning present (i.e., it is "asserted"), signals to the UA that it should
Policy contained should be applied to the Pinned Host exactly as apply to the Pinned Host the Pinning Policy expressed in the PKP
specified, ignoring local client policy. header exactly as specified, ignoring local client policy.
2.1.5. Examples 2.1.5. Examples
Figure 3 shows some example response header fields using the pins Figure 3 shows some example response header fields using the pins
extension (folded for clarity). extension (folded for clarity).
Public-Key-Pins: max-age=500; Public-Key-Pins: max-age=3000;
pin-sha1="4n972HfV354KP560yw4uqe/baXc="; pin-sha1="4n972HfV354KP560yw4uqe/baXc=";
pin-sha1="IvGeLsbqzPxdI0b0wuj2xVTdXgc=" pin-sha1="IvGeLsbqzPxdI0b0wuj2xVTdXgc="
Public-Key-Pins: max-age=31536000; Public-Key-Pins: max-age=2592000;
pin-sha1="4n972HfV354KP560yw4uqe/baXc="; pin-sha1="4n972HfV354KP560yw4uqe/baXc=";
pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ=" pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="
Public-Key-Pins: max-age=2592000;
pin-sha1="4n972HfV354KP560yw4uqe/baXc=";
pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ=";
report-uri="http://example.com/pkp-report"
Public-Key-Pins-Report-Only: max-age=2592000;
pin-sha1="4n972HfV354KP560yw4uqe/baXc=";
pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ=";
report-uri="http://example.com/pkp-report"
Public-Key-Pins: pin-sha1="4n972HfV354KP560yw4uqe/baXc="; Public-Key-Pins: pin-sha1="4n972HfV354KP560yw4uqe/baXc=";
pin-sha1="qvTGHdzF6KLavt4PO0gs2a6pQ00="; pin-sha1="qvTGHdzF6KLavt4PO0gs2a6pQ00=";
pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ=";
max-age=2592000 max-age=259200
Public-Key-Pins: pin-sha1="4n972HfV354KP560yw4uqe/baXc="; Public-Key-Pins: pin-sha1="4n972HfV354KP560yw4uqe/baXc=";
pin-sha1="qvTGHdzF6KLavt4PO0gs2a6pQ00="; pin-sha1="qvTGHdzF6KLavt4PO0gs2a6pQ00=";
pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ="; pin-sha256="LPJNul+wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ=";
max-age=2592000; includeSubDomains max-age=10000; includeSubDomains
Figure 3: HPKP Header Examples Figure 3: HPKP Header Examples
2.2. Server Processing Model 2.2. Server Processing Model
This section describes the processing model that Pinned Hosts This section describes the processing model that Pinned Hosts
implement. The model comprises two facets: the processing rules for implement. The model comprises two facets: the processing rules for
HTTP request messages received over a secure transport (e.g. TLS HTTP request messages received over a secure transport (e.g. TLS
[RFC5246]); and the processing rules for HTTP request messages [RFC5246]); and the processing rules for HTTP request messages
received over non-secure transports, such as TCP. received over non-secure transports, such as TCP.
skipping to change at page 9, line 23 skipping to change at page 9, line 30
Otherwise, if the substring does not congruently match a Known Pinned Otherwise, if the substring does not congruently match a Known Pinned
Host's domain name, per the matching procedure specified in Host's domain name, per the matching procedure specified in
Section 8.2 of [RFC6797], then the UA MUST note this host as a Known Section 8.2 of [RFC6797], then the UA MUST note this host as a Known
Pinned Host, caching the Pinned Host's domain name and noting along Pinned Host, caching the Pinned Host's domain name and noting along
with it the time of the observation (also known as the Effective Pin with it the time of the observation (also known as the Effective Pin
Date), the value of the max-age directive, whether or not the Date), the value of the max-age directive, whether or not the
includeSubDomains or strict directives are asserted, the value of the includeSubDomains or strict directives are asserted, the value of the
report-uri directive (if present), and any other metadata from report-uri directive (if present), and any other metadata from
optional or future PKP header directives. optional or future PKP header directives.
UAs SHOULD set an upper limit on the value of max-age, so that UAs UAs MAY set an upper limit on the value of max-age, so that UAs that
that have noted erroneous pins (whether by accident or due to attack) have noted erroneous pins (whether by accident or due to attack) have
have some chance of recovering over time. If the server sets a max- some chance of recovering over time. If the server sets a max-age
age greater than the UA's upper limit, the UA SHOULD behave as if the greater than the UA's upper limit, the UA MAY behave as if the server
server set the max-age to the UA's upper limit. For example, if the set the max-age to the UA's upper limit. For example, if the UA caps
UA caps max-age at 2592000 seconds (30 days), and a Pinned Host sets max-age at 5184000 seconds (60 days), and a Pinned Host sets a max-
a max-age directive of 60 days in its Valid Pinning Header, the UA age directive of 90 days in its Valid Pinning Header, the UA MAY
SHOULD behave as if the max-age were effectively 30 days. (One way behave as if the max-age were effectively 60 days. (One way to
to achieve this behavior is for the UA to simply store a value of 30 achieve this behavior is for the UA to simply store a value of 60
days instead of the 60 day value provided by the Pinned Host.) For days instead of the 90 day value provided by the Pinned Host.) For
UA implementation guidance on how to select a maximum max-age, see UA implementation guidance on how to select a maximum max-age, see
Section 4.1. Section 4.1.
The UA MUST NOT modify any pinning metadata of any superdomain The UA MUST NOT modify any pinning metadata of any superdomain
matched Known Pinned Host. matched Known Pinned Host.
A Known Pinned Host is "expired" if the Effective Pin Date plus the A Known Pinned Host is "expired" if the Effective Pin Date plus the
max-age refers to a date in the past. The UA MUST ignore all expired max-age refers to a date in the past. The UA MUST ignore all expired
Known Pinned Hosts from its cache, if at any time, an expired Known Known Pinned Hosts from its cache if, at any time, an expired Known
Pinned Host exists in the cache. Pinned Host exists in the cache.
2.3.3. HTTP-Equiv <Meta> Element Attribute 2.3.3. HTTP-Equiv <Meta> Element Attribute
UAs MUST NOT heed http-equiv="Public-Key-Pins" attribute settings on UAs MUST NOT heed http-equiv="Public-Key-Pins" attribute settings on
<meta> elements [W3C.REC-html401-19991224] in received content. <meta> elements [W3C.REC-html401-19991224] in received content.
2.3.4. UA Processing Examples
TODO.
2.4. Semantics of Pins 2.4. Semantics of Pins
An SPKI Fingerprint is defined as the output of a known cryptographic An SPKI Fingerprint is defined as the output of a known cryptographic
hash algorithm whose input is the DER-encoded ASN.1 representation of hash algorithm whose input is the DER-encoded ASN.1 representation of
the SubjectPublicKeyInfo (SPKI) field of an X.509 certificate. A Pin the SubjectPublicKeyInfo (SPKI) field of an X.509 certificate. A Pin
is defined as the combination of the known algorithm identifier and is defined as the combination of the known algorithm identifier and
the SPKI Fingerprint computed using that algorithm. the SPKI Fingerprint computed using that algorithm.
The SPKI Fingerprint is encoded in base 64 for use in an HTTP header. The SPKI Fingerprint is encoded in base 64 for use in an HTTP header.
(See [RFC4648].) (See [RFC4648].)
skipping to change at page 11, line 6 skipping to change at page 11, line 4
parameters, a public key pin cannot be formed. parameters, a public key pin cannot be formed.
We pin public keys, rather than entire certificates, to enable We pin public keys, rather than entire certificates, to enable
operators to generate new certificates containing old public keys operators to generate new certificates containing old public keys
(see [why-pin-key]). (see [why-pin-key]).
See Appendix A for an example non-normative program that generates See Appendix A for an example non-normative program that generates
SPKI Fingerprints from SubjectPublicKeyInfo fields in certificates. SPKI Fingerprints from SubjectPublicKeyInfo fields in certificates.
2.5. Noting Pins 2.5. Noting Pins
Upon receipt of the Public-Key-Pins response header field, the UA Upon receipt of the Public-Key-Pins response header field, the UA
notes the host as a Pinned Host, storing the Pins and their notes the host as a Pinned Host, storing the Pins and their
associated directives in non-volatile storage (for example, along associated directives in non-volatile storage (for example, along
with the HSTS metadata). The Pins and their associated directives with the HSTS metadata). The Pins and their associated directives
collectively known as Pinning Metadata. are collectively known as Pinning Metadata.
The UA MUST observe these conditions when noting a Host: The UA MUST observe these conditions when noting a Host:
o The UA MUST note the Pins if and only if it received the Public- o The UA MUST note the Pins if and only if it received the Public-
Key-Pins response header field over an error-free TLS connection. Key-Pins response header field over an error-free TLS connection.
If the host is a Pinned Host, this includes the validation added If the host is a Pinned Host, this includes the validation added
in Section 2.6. in Section 2.6.
o The UA MUST note the Pins if and only if the TLS connection was o The UA MUST note the Pins if and only if the TLS connection was
authenticated with a certificate chain containing at least one of authenticated with a certificate chain containing at least one of
skipping to change at page 11, line 46 skipping to change at page 11, line 43
connections that do not meet the first criterion. connections that do not meet the first criterion.
Whenever a UA receives a Valid Pinning Header, it MUST set its Whenever a UA receives a Valid Pinning Header, it MUST set its
Pinning Metadata to the exact Pins, max-age, and (if any) report-uri Pinning Metadata to the exact Pins, max-age, and (if any) report-uri
and strict mode given in the most recently received Valid Pinning and strict mode given in the most recently received Valid Pinning
Header. Header.
For forward compatibility, the UA MUST ignore any unrecognized For forward compatibility, the UA MUST ignore any unrecognized
Public-Key-Pins header directives, while still processing those Public-Key-Pins header directives, while still processing those
directives it does recognize. Section 2.1 specifies the directives directives it does recognize. Section 2.1 specifies the directives
max-age, pins, includeSubDomains, report-uri, and strict, but future max.age, pins, includeSubDomains, report-uri, and strict, but future
specifications and implementations might use additional directives. specifications and implementations might use additional directives.
2.6. Validating Pinned Connections 2.6. Validating Pinned Connections
When a UA connects to a Pinned Host, if the TLS connection has When a UA connects to a Pinned Host, if the TLS connection has
errors, the UA MUST terminate the connection without allowing the errors, the UA MUST terminate the connection without allowing the
user to proceed anyway. (This behavior is the same as that required user to proceed anyway. (This behavior is the same as that required
by [RFC6797].) by [RFC6797].)
If the connection has no errors, then the UA will determine whether If the connection has no errors, then the UA will determine whether
to apply a new, additional correctness check: Pin Validation. A UA to apply a new, additional correctness check: Pin Validation. A UA
SHOULD perform Pin Validation whenever connecting to a Known Pinned SHOULD perform Pin Validation whenever connecting to a Known Pinned
Host, but MAY allow Pin Validation to be disabled for Hosts according Host, but MAY allow Pin Validation to be disabled for Hosts according
to local policy. For example, a UA may disable Pin Validation for to local policy. For example, a UA may disable Pin Validation for
Pinned Hosts whose validated certificate chain terminates at a user- Pinned Hosts whose validated certificate chain terminates at a user-
defined trust anchor, rather than a trust anchor built-in to the UA. defined trust anchor, rather than a trust anchor built-in to the UA.
However, if the Pinned Host Metadata indicates that the Pinned Host However, if the Pinned Host Metadata indicates that the Pinned Host
is operating in "strict mode" (see Section 2.1.4), then the UA MUST is operating in "strict mode" (see Section 2.1.4), then the UA MUST
perform Pin Validation. perform Pin Validation.
skipping to change at page 12, line 22 skipping to change at page 12, line 19
Pinned Hosts whose validated certificate chain terminates at a user- Pinned Hosts whose validated certificate chain terminates at a user-
defined trust anchor, rather than a trust anchor built-in to the UA. defined trust anchor, rather than a trust anchor built-in to the UA.
However, if the Pinned Host Metadata indicates that the Pinned Host However, if the Pinned Host Metadata indicates that the Pinned Host
is operating in "strict mode" (see Section 2.1.4), then the UA MUST is operating in "strict mode" (see Section 2.1.4), then the UA MUST
perform Pin Validation. perform Pin Validation.
To perform Pin Validation, the UA will compute the SPKI Fingerprints To perform Pin Validation, the UA will compute the SPKI Fingerprints
for each certificate in the Pinned Host's validated certificate for each certificate in the Pinned Host's validated certificate
chain, using each supported hash algorithm for each certificate. chain, using each supported hash algorithm for each certificate.
(For the purposes of Pin Validation, the UA MUST ignore certificates (For the purposes of Pin Validation, the UA MUST ignore certificates
whose SPKI cannot be taken in isolation and superfluous certificates whose SPKI cannot be taken in isolation, and MUST ignore superfluous
in the chain that do not form part of the validating chain.) The UA certificates in the chain that do not form part of the validating
will then check that the set of these SPKI Fingerprints intersects chain.) The UA will then check that the set of these SPKI
the set of SPKI Fingerprints in that Pinned Host's Pinning Metadata. Fingerprints intersects the set of SPKI Fingerprints in that Pinned
If there is set intersection, the UA continues with the connection as Host's Pinning Metadata. If there is set intersection, the UA
normal. Otherwise, the UA MUST treat this Pin Failure as a non- continues with the connection as normal. Otherwise, the UA MUST
recoverable error. Any procedure that matches the results of this treat this Pin Failure as a non-recoverable error. Any procedure
Pin Validation procedure is considered equivalent. that matches the results of this Pin Validation procedure is
considered equivalent.
Note that, although the UA has previously received Pins at the HTTP Note that, although the UA has previously received Pins at the HTTP
layer, it can and MUST perform Pin Validation at the TLS layer, layer, it can and MUST perform Pin Validation at the TLS layer,
before beginning an HTTP conversation over the TLS channel. The TLS before beginning an HTTP conversation over the TLS channel. The TLS
layer thus evaluates TLS connections with pinning information the UA layer thus evaluates TLS connections with pinning information the UA
received previously, regardless of mechanism: statically preloaded, received previously, regardless of mechanism: statically preloaded,
via HTTP header, or some other means (possibly in the TLS layer via HTTP header, or some other means (possibly in the TLS layer
itself). itself).
2.7. Interactions With Preloaded Pin Lists 2.7. Interactions With Preloaded Pin Lists
skipping to change at page 13, line 23 skipping to change at page 13, line 20
hosts. In such a solution, the pre-configured list should track when hosts. In such a solution, the pre-configured list should track when
the Valid Pinning Header was last observed, in order to permit site the Valid Pinning Header was last observed, in order to permit site
operators to later update the value by supplying a new Valid Pinning operators to later update the value by supplying a new Valid Pinning
Header. Updates to such a pre-configured list should not update the Header. Updates to such a pre-configured list should not update the
Effective Pin Dates for each host unless the list vendor has actually Effective Pin Dates for each host unless the list vendor has actually
observed a more recent header. This is to prevent situations where observed a more recent header. This is to prevent situations where
updating the Effective Pin Date on a pre-configured list of pins may updating the Effective Pin Date on a pre-configured list of pins may
effectively extend the max-age beyond the site operator's stated effectively extend the max-age beyond the site operator's stated
policy. policy.
Example: An alternative example would be a UA that ships with a pre- Example: A UA may ship with a pre-configured list of pins that are
configured list of pins that are collected through out-of-band means, collected through out-of-band means, such as direct contact with the
such as direct contact with the site operator. In such a solution, site operator. In such a solution, the site operator accepts
the site operator accepts responsibility for keeping the configured responsibility for keeping the configured Valid Pinning Header in
Valid Pinning Header in sync with the vendor's list, allowing the UA sync with the vendor's list, allowing the UA vendor to have each
vendor to have each update to the list be treated as as an update of update to the list be treated as as an update of the Effective Pin
the Effective Pin Date. Date.
2.8. Pinning Self-Signed End Entities 2.8. Pinning Self-Signed End Entities
If UAs accept hosts that authenticate themselves with self-signed end If UAs accept hosts that authenticate themselves with self-signed end
entity certificates, they MAY also allow hosts to pin the public keys entity certificates, they MAY also allow hosts to pin the public keys
in such certificates. The usability and security implications of in such certificates. The usability and security implications of
this practice are outside the scope of this specification. this practice are outside the scope of this specification.
3. Reporting Pin Validation Failure 3. Reporting Pin Validation Failure
skipping to change at page 15, line 25 skipping to change at page 15, line 22
Operators can pin any one or more of the public keys in this chain, Operators can pin any one or more of the public keys in this chain,
and indeed could pin to issuers not in the chain (as, for example, a and indeed could pin to issuers not in the chain (as, for example, a
Backup Pin). Pinning to an intermediate issuer, or even to a trust Backup Pin). Pinning to an intermediate issuer, or even to a trust
anchor or root, still significantly reduces the number of issuers who anchor or root, still significantly reduces the number of issuers who
can issue end entity certificates for the Known Pinned Host, while can issue end entity certificates for the Known Pinned Host, while
still giving that host flexibility to change keys without a still giving that host flexibility to change keys without a
disruption of service. disruption of service.
4.1. Maximum max-age 4.1. Maximum max-age
As mentioned in Section 2.3.2, UAs SHOULD cap the max-age value at As mentioned in Section 2.3.2, UAs MAY cap the max-age value at some
some upper limit. There is a security trade-off in that low maximum upper limit. There is a security trade-off in that low maximum
values provide a narrow window of protection for users who visit the values provide a narrow window of protection for users who visit the
Known Pinned Host only infrequently, while high maximum values might Known Pinned Host only infrequently, while high maximum values might
potentially result in a UA's inability to successfully perform Pin potentially result in a UA's inability to successfully perform Pin
Validation for a Known Pinned Host if the UA's noted pins and the Validation for a Known Pinned Host if the UA's noted pins and the
Host's true pins diverge. Host's true pins diverge.
Such divergence could occur for several reasons, including: UA error; Such divergence could occur for several reasons, including: UA error;
Host operator error; network attack; or a Known Pinned Host that Host operator error; network attack; or a Known Pinned Host that
intentionally migrates all pinned keys, combined with a UA that has intentionally migrates all pinned keys, combined with a UA that has
noted true pins with a high max-age value and has not had a chance to noted true pins with a high max-age value and has not had a chance to
observe the new true pins for the Host. (This last example observe the new true pins for the Host. (This last example
underscores the importance for Host operators to phase in new keys underscores the importance for Host operators to phase in new keys
gradually, and to set the max-age value in accordance with their gradually, and to set the max-age value in accordance with their
planned key migration schedule.) planned key migration schedule.)
There is probably no ideal upper limit to the max-age directive that There is probably no ideal upper limit to the max-age directive that
would satisfy all use cases. However, a value on the order of 30 would satisfy all use cases. However, a value on the order of 60
days (2592000 seconds) may be considered a balance between the two days (5184000 seconds) may be considered a balance between the two
competing security concerns. competing security concerns.
4.2. Using includeSubdomains Safely 4.2. Using includeSubDomains Safely
It may happen that Pinned Hosts whose hostnames share a parent domain It may happen that Pinned Hosts whose hostnames share a parent domain
use different Valid Pinning Headers. If a Host whose hostname is a use different Valid Pinning Headers. If a Host whose hostname is a
parent domain for another Host sets the includeSubdomains directive, parent domain for another Host sets the includeSubDomains directive,
the Hosts' pins may conflict with each other. For example, consider the two Hosts' pins may conflict with each other. For example,
two Known Pinned Hosts, example.com and subdomain.example.com. consider two Known Pinned Hosts, example.com and
Assume example.com sets a Valid Pinning Header such as this: subdomain.example.com. Assume example.com sets a Valid Pinning
Header such as this:
Public-Key-Pins: pin-sha1="ABC..."; pin-sha1="DEF..."; includeSubdomains Public-Key-Pins: pin-sha1="ABC..."; pin-sha1="DEF..."; includeSubDomains
Figure 7: example.com Valid Pinning Header Figure 7: example.com Valid Pinning Header
Assume subdomain.example.com sets a Valid Pinning Header such as Assume subdomain.example.com sets a Valid Pinning Header such as
this: this:
Public-Key-Pins: pin-sha1="GHI..."; pin-sha1="JKL..." Public-Key-Pins: pin-sha1="GHI..."; pin-sha1="JKL..."
Figure 8: subdomain.example.com Valid Pinning Header Figure 8: subdomain.example.com Valid Pinning Header
Assume a UA that has not previously noted any pins for either of Assume a UA that has not previously noted any pins for either of
these Hosts. If the UA first contacts subdomain.example.com, it will these Hosts. If the UA first contacts subdomain.example.com, it will
note the pins in the Valid Pinning Header, and perform Pin Validation note the pins in the Valid Pinning Header, and perform Pin Validation
as normal on subsequent conections. If the UA then contacts as normal on subsequent conections. If the UA then contacts
example.com, again it will note the pins and perform Pin Validation example.com, again it will note the pins and perform Pin Validation
on future connections. However, if the UA happened to first on future connections. However, if the UA happened to first
example.com before subdomain.example.com, the UA would, due to example.com before subdomain.example.com, the UA would, due to
example.com's use of the includeSubdomains directive, attempt to example.com's use of the includeSubDomains directive, attempt to
perform Pin Validation for subdomain.example.com using the SPKI perform Pin Validation for subdomain.example.com using the SPKI
hashes ABC... and DEF..., which are not valid for the certificate hashes ABC... and DEF..., which are not valid for the certificate
chains subdomain.example.com (which uses certificates with SPKIs chains subdomain.example.com (which uses certificates with SPKIs
GHI... and JLK...). Thus, depending on the order in which the UA GHI... and JLK...). Thus, depending on the order in which the UA
observes the Valid Pinning Headers for hosts example.com and observes the Valid Pinning Headers for hosts example.com and
subdomain.example.com, Pin Validation might or might not fail for subdomain.example.com, Pin Validation might or might not fail for
subdomain.example.com, even if the certificate chain the UA receives subdomain.example.com, even if the certificate chain the UA receives
for subdomain.example.com is perfectly valid. for subdomain.example.com is perfectly valid.
Thus, Pinned Host operators must take care that they use the Thus, Pinned Host operators must use the includeSubDomains directive
includeSubdomains directive with care. For example, they may choose with care. For example, they may choose to use overlapping pin sets
to use overlapping pin sets for hosts under a parent domain that uses for hosts under a parent domain that uses includeSubDomains, or to
includeSubdomains, or to not use the includeSubdomains directive in not use the includeSubDomains directive in their effective-second-
their effective-second-level domains, or to simply use the same pin level domains, or to simply use the same pin set for all hosts under
set for all hosts under a given parent domain. a given parent domain.
4.3. Backup Pins 4.3. Backup Pins
The primary way to cope with the risk of inadvertant Pin Failure is The primary way to cope with the risk of inadvertent Pin Failure is
to keep a Backup Pin. A Backup Pin is a fingerprint for the public to keep a Backup Pin. A Backup Pin is a fingerprint for the public
key of a secondary, not-yet-deployed key pair. The operator keeps key of a secondary, not-yet-deployed key pair. The operator keeps
the backup key pair offline, and sets a pin for it in the Public-Key- the backup key pair offline, and sets a pin for it in the Public-Key-
Pins header. Then, in case the operator loses control of their Pins header. Then, in case the operator loses control of their
primary private key, they can deploy the backup key pair. UAs, who primary private key, they can deploy the backup key pair. UAs, who
have had the backup key pair pinned (when it was set in previous have had the backup key pair pinned (when it was set in previous
Valid Pinning Headers), can connect to the host without error. Valid Pinning Headers), can connect to the host without error.
Because having a backup key pair is so important to recovery, UAs Because having a backup key pair is so important to recovery, UAs
MUST require that hosts set a Backup Pin. (See Section 2.5.) MUST require that hosts set a Backup Pin. (See Section 2.5.)
skipping to change at page 17, line 31 skipping to change at page 17, line 36
experience denial of service. UAs MUST explain the reason why, i.e. experience denial of service. UAs MUST explain the reason why, i.e.
that it was impossible to verify the confirmed cryptographic identity that it was impossible to verify the confirmed cryptographic identity
of the host. of the host.
UAs MUST have a way for users to clear current pins for Pinned Hosts. UAs MUST have a way for users to clear current pins for Pinned Hosts.
UAs SHOULD have a way for users to query the current state of Pinned UAs SHOULD have a way for users to query the current state of Pinned
Hosts. Hosts.
7. Acknowledgements 7. Acknowledgements
Thanks to Tobias Gondrom, Jeff Hodges, Adam Langley, Nicolas Thanks to Tobias Gondrom, Jeff Hodges, Ivan Krstic, Adam Langley,
Lidzborski, SM, James Manger, Eric Rescorla, Paul Hoffman, and Yoav Nicolas Lidzborski, SM, James Manger, Eric Rescorla, Paul Hoffman,
Nir for suggestions and edits that clarified the text. Thanks to and Yoav Nir for suggestions and edits that clarified the text.
Trevor Perrin for suggesting a mechanism to affirmatively break pins Thanks to Trevor Perrin for suggesting a mechanism to affirmatively
([pin-break-codes]). Adam Langley provided the SPKI fingerprint break pins ([pin-break-codes]).
generation code.
8. What's Changed 8. What's Changed
Changed non-normative pin generation code from Go to POSIX shell
script using openssl.
Changed max-max-age from SHOULD to MAY, and used the example of 60
days instead of 30.
Removed the section "Pin Validity Times", which was intended to be in Removed the section "Pin Validity Times", which was intended to be in
harmony with [I-D.perrin-tls-tack]. Now using max-age purely as harmony with [I-D.perrin-tls-tack]. Now using max-age purely as
specified in [RFC6797]. specified in [RFC6797].
Added new directives: includeSubDomains, report-uri and strict. Added new directives: includeSubDomains, report-uri and strict.
Added a new variant of the PKP Header: Public-Key-Pins-Report-Only. Added a new variant of the PKP Header: Public-Key-Pins-Report-Only.
Removed the section on pin break codes and verifiers, in favor the of Removed the section on pin break codes and verifiers, in favor the of
most-recently-received policy (Section 2.5). most-recently-received policy (Section 2.5).
skipping to change at page 19, line 14 skipping to change at page 19, line 17
[RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S.,
Housley, R., and W. Polk, "Internet X.509 Public Key Housley, R., and W. Polk, "Internet X.509 Public Key
Infrastructure Certificate and Certificate Revocation List Infrastructure Certificate and Certificate Revocation List
(CRL) Profile", RFC 5280, May 2008. (CRL) Profile", RFC 5280, May 2008.
[RFC6797] Hodges, J., Jackson, C., and A. Barth, "HTTP Strict [RFC6797] Hodges, J., Jackson, C., and A. Barth, "HTTP Strict
Transport Security (HSTS)", RFC 6797, November 2012. Transport Security (HSTS)", RFC 6797, November 2012.
[W3C.REC-html401-19991224] [W3C.REC-html401-19991224]
Hors, A., Raggett, D., and I. Jacobs, "HTML 4.01 Hors, A., Jacobs, I., and D. Raggett, "HTML 4.01
Specification", World Wide Web Consortium Recommendation Specification", World Wide Web Consortium Recommendation
REC-html401-19991224, December 1999, REC-html401-19991224, December 1999,
<http://www.w3.org/TR/1999/REC-html401-19991224>. <http://www.w3.org/TR/1999/REC-html401-19991224>.
9.2. Informative References 9.2. Informative References
[I-D.perrin-tls-tack] [I-D.perrin-tls-tack]
Marlinspike, M., "Trust Assertions for Certificate Keys", Marlinspike, M., "Trust Assertions for Certificate Keys",
draft-perrin-tls-tack-02 (work in progress), January 2013. draft-perrin-tls-tack-02 (work in progress), January 2013.
[pin-break-codes] [pin-break-codes]
Perrin, T., "Self-Asserted Key Pinning", September 2011, Perrin, T., "Self-Asserted Key Pinning", September 2011,
<http://trevp.net/SAKP/>. <http://trevp.net/SAKP/>.
[why-pin-key] [why-pin-key]
Langley, A., "Public Key Pinning", May 2011, Langley, A., "Public Key Pinning", May 2011,
<http://www.imperialviolet.org/2011/05/04/pinning.html>. <http://www.imperialviolet.org/2011/05/04/pinning.html>.
Appendix A. Fingerprint Generation Appendix A. Fingerprint Generation
This Go program generates SPKI Fingerprints, suitable for use in This POSIX shell program generates SPKI Fingerprints, suitable for
pinning, from PEM-encoded certificates. It is non-normative. use in pinning, from PEM-encoded certificates. It is non-normative.
package main
import (
"io/ioutil"
"os"
"crypto/sha1"
"crypto/x509"
"encoding/base64"
"encoding/pem"
"fmt"
)
func main() {
if len(os.Args) < 2 {
fmt.Printf("Usage: %s PEM-filename\n", os.Args[0])
os.Exit(1)
}
pemBytes, err := ioutil.ReadFile(os.Args[1])
if err != nil {
panic(err.String())
}
block, _ := pem.Decode(pemBytes)
if block == nil {
panic("No PEM structure found")
}
derBytes := block.Bytes
certs, err := x509.ParseCertificates(derBytes)
if err != nil {
panic(err.String())
}
cert := certs[0]
h := sha1.New()
h.Write(cert.RawSubjectPublicKeyInfo)
digest := h.Sum()
fmt.Printf("Hex: %x\nBase64: %s\n", digest, openssl x509 -noout -in certificate.pem -pubkey | \
base64.StdEncoding.EncodeToString(digest)) openssl asn1parse -inform pem -out public.key
} openssl dgst -sha1 -binary public.key | base64
Figure 9: Example SPKI Fingerprint Generation Code Figure 9: Example SPKI Fingerprint Generation Code
Appendix B. Deployment Guidance Appendix B. Deployment Guidance
This section is non-normative guidance which may smooth the adoption This section is non-normative guidance which may smooth the adoption
of public key pinning. of public key pinning.
o Operators SHOULD get the backup public key signed by a different o Operators SHOULD get the backup public key signed by a different
(root and/or intermediary) CA than their primary certificate, and (root and/or intermediary) CA than their primary certificate, and
 End of changes. 39 change blocks. 
124 lines changed or deleted 96 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/