Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_HTTP_HTTP_SECURITY_HEADERS_H_ | 5 #ifndef NET_HTTP_HTTP_SECURITY_HEADERS_H_ |
| 6 #define NET_HTTP_HTTP_SECURITY_HEADERS_H_ | 6 #define NET_HTTP_HTTP_SECURITY_HEADERS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 // | 26 // |
| 27 // value is the right-hand side of: | 27 // value is the right-hand side of: |
| 28 // | 28 // |
| 29 // "Strict-Transport-Security" ":" | 29 // "Strict-Transport-Security" ":" |
| 30 // [ directive ] *( ";" [ directive ] ) | 30 // [ directive ] *( ";" [ directive ] ) |
| 31 bool NET_EXPORT_PRIVATE ParseHSTSHeader(const std::string& value, | 31 bool NET_EXPORT_PRIVATE ParseHSTSHeader(const std::string& value, |
| 32 base::TimeDelta* max_age, | 32 base::TimeDelta* max_age, |
| 33 bool* include_subdomains); | 33 bool* include_subdomains); |
| 34 | 34 |
| 35 // Parses |value| as a Public-Key-Pins header value. If successful, returns | 35 // Parses |value| as a Public-Key-Pins header value. If successful, returns |
| 36 // true and populates the |*max_age|, |*include_subdomains|, and |*hashes| | 36 // true and populates the |*max_age|, |*include_subdomains|, |*hashes|, and |
| 37 // values. Otherwise returns false and leaves the output parameters | 37 // |*report_uri| values. Otherwise returns false and leaves the output |
| 38 // unchanged. | 38 // parameters unchanged. |
| 39 // | 39 // |
| 40 // value is the right-hand side of: | 40 // value is the right-hand side of: |
| 41 // | 41 // |
| 42 // "Public-Key-Pins" ":" | 42 // "Public-Key-Pins" ":" |
| 43 // "max-age" "=" delta-seconds ";" | 43 // "max-age" "=" delta-seconds ";" |
| 44 // "pin-" algo "=" base64 [ ";" ... ] | 44 // "pin-" algo "=" base64 [ ";" ... ] |
| 45 // [ ";" "includeSubdomains" ] | 45 // [ ";" "includeSubdomains" ] |
| 46 // [ ";" "report-uri" "=" uri-reference ] | 46 // [ ";" "report-uri" "=" uri-reference ] |
| 47 // | 47 // |
| 48 // For this function to return true, the key hashes specified by the HPKP | 48 // For this function to return true, the key hashes specified by the HPKP |
| 49 // header must pass two additional checks. There MUST be at least one key | 49 // header must pass two additional checks. There MUST be at least one key |
| 50 // hash which matches the SSL certificate chain of the current site (as | 50 // hash which matches the SSL certificate chain of the current site (as |
| 51 // specified by the chain_hashes) parameter. In addition, there MUST be at | 51 // specified by the chain_hashes) parameter. In addition, there MUST be at |
| 52 // least one key hash which does NOT match the site's SSL certificate chain | 52 // least one key hash which does NOT match the site's SSL certificate chain |
| 53 // (this is the "backup pin"). | 53 // (this is the "backup pin"). |
| 54 bool NET_EXPORT_PRIVATE ParseHPKPHeader(const std::string& value, | 54 bool NET_EXPORT_PRIVATE ParseHPKPHeader(const std::string& value, |
| 55 const HashValueVector& chain_hashes, | 55 const HashValueVector& chain_hashes, |
| 56 base::TimeDelta* max_age, | 56 base::TimeDelta* max_age, |
| 57 bool* include_subdomains, | 57 bool* include_subdomains, |
| 58 HashValueVector* hashes, | 58 HashValueVector* hashes, |
| 59 GURL* report_uri); | 59 GURL* report_uri); |
| 60 | 60 |
| 61 // Parses |value| as a Public-Key-Pins-Report-Only header value. If | |
| 62 // successful, returns true and populates the |*hashes| and | |
| 63 // |*report_uri| values. Otherwise returns false and leaves the output | |
| 64 // parameters unchanged. | |
| 65 // | |
| 66 // value is the right-hand side of: | |
| 67 // | |
| 68 // "Public-Key-Pins-Report-Only" ":" | |
| 69 // [ "max-age" "=" delta-seconds ";" ] | |
| 70 // "pin-" algo "=" base64 [ ";" ... ] | |
| 71 // [ ";" "includeSubdomains" ] | |
| 72 // [ ";" "report-uri" "=" uri-reference ] | |
| 73 // | |
| 74 bool NET_EXPORT_PRIVATE ParseHPKPReportOnlyHeader(const std::string& value, | |
| 75 HashValueVector* hashes, | |
| 76 GURL* report_uri); | |
|
Ryan Sleevi
2015/07/30 01:43:50
Is there any reason to introduce a separate method
estark
2015/07/30 02:43:49
The main reason is that ParseHPKPHeader() does som
Ryan Sleevi
2015/07/30 02:52:25
Both of these apply.
UAs MUST ignore any h
estark
2015/07/30 15:21:21
Yep, sorry, I meant the presence check.
| |
| 61 } // namespace net | 77 } // namespace net |
| 62 | 78 |
| 63 #endif // NET_HTTP_HTTP_SECURITY_HEADERS_H_ | 79 #endif // NET_HTTP_HTTP_SECURITY_HEADERS_H_ |
| OLD | NEW |