OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NET_HTTP_HTTP_SECURITY_HEADERS_H_ |
| 6 #define NET_HTTP_HTTP_SECURITY_HEADERS_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "base/gtest_prod_util.h" |
| 12 #include "base/time.h" |
| 13 #include "base/values.h" |
| 14 #include "net/base/net_export.h" |
| 15 #include "net/base/ssl_info.h" |
| 16 #include "net/base/x509_cert_types.h" |
| 17 |
| 18 namespace net { |
| 19 |
| 20 const int64 kMaxHSTSAgeSecs = 86400 * 365; // 1 year |
| 21 |
| 22 // Parses |value| as a Strict-Transport-Security header value. If successful, |
| 23 // returns true and sets |*expiry| and |*include_subdomains|. |
| 24 // Otherwise returns false and leaves the output parameters unchanged. |
| 25 // Interprets the max-age directive relative to |now|. |
| 26 // |
| 27 // value is the right-hand side of: |
| 28 // |
| 29 // "Strict-Transport-Security" ":" |
| 30 // [ directive ] *( ";" [ directive ] ) |
| 31 bool NET_EXPORT_PRIVATE ParseHSTSHeader(const base::Time& now, |
| 32 const std::string& value, |
| 33 base::Time* expiry, // OUT |
| 34 bool* include_subdomains); // OUT |
| 35 |
| 36 // Parses |value| as a Public-Key-Pins header value. If successful, |
| 37 // returns true and populates the expiry and hashes values. |
| 38 // Otherwise returns false and leaves the output parameters unchanged. |
| 39 // Interprets the max-age directive relative to |now|. |
| 40 // Checks that the header's public key pins overlaps with the SSL chain |
| 41 // as specified in ssl_info. |
| 42 // |
| 43 // value is the right-hand side of: |
| 44 // |
| 45 // "Public-Key-Pins" ":" |
| 46 // "max-age" "=" delta-seconds ";" |
| 47 // "pin-" algo "=" base64 [ ";" ... ] |
| 48 bool NET_EXPORT_PRIVATE ParseHPKPHeader(const base::Time& now, |
| 49 const std::string& value, |
| 50 const SSLInfo& ssl_info, |
| 51 base::Time* expiry, // OUT |
| 52 HashValueVector* hashes); // OUT |
| 53 |
| 54 } // namespace net |
| 55 |
| 56 |
| 57 #endif // NET_HTTP_HTTP_SECURITY_HEADERS_H_ |
| 58 |
OLD | NEW |