| 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 #include <stdint.h> | 5 #include <stdint.h> |
| 6 #include <algorithm> | 6 #include <algorithm> |
| 7 | 7 |
| 8 #include "base/base64.h" | 8 #include "base/base64.h" |
| 9 #include "base/strings/string_piece.h" | 9 #include "base/strings/string_piece.h" |
| 10 #include "crypto/sha2.h" | 10 #include "crypto/sha2.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 } | 50 } |
| 51 | 51 |
| 52 std::string GetTestPin(uint8_t label, HashValueTag tag) { | 52 std::string GetTestPin(uint8_t label, HashValueTag tag) { |
| 53 return GetTestPinImpl(label, tag, true); | 53 return GetTestPinImpl(label, tag, true); |
| 54 } | 54 } |
| 55 | 55 |
| 56 std::string GetTestPinUnquoted(uint8_t label, HashValueTag tag) { | 56 std::string GetTestPinUnquoted(uint8_t label, HashValueTag tag) { |
| 57 return GetTestPinImpl(label, tag, false); | 57 return GetTestPinImpl(label, tag, false); |
| 58 } | 58 } |
| 59 | 59 |
| 60 }; | 60 } // anonymous namespace |
| 61 | 61 |
| 62 // Parses the given header |value| as both a Public-Key-Pins-Report-Only | 62 // Parses the given header |value| as both a Public-Key-Pins-Report-Only |
| 63 // and Public-Key-Pins header. Returns true if the value parses | 63 // and Public-Key-Pins header. Returns true if the value parses |
| 64 // successfully for both header types, and if the parsed hashes and | 64 // successfully for both header types, and if the parsed hashes and |
| 65 // report_uri match for both header types. | 65 // report_uri match for both header types. |
| 66 bool ParseAsHPKPHeader(const std::string& value, | 66 bool ParseAsHPKPHeader(const std::string& value, |
| 67 const HashValueVector& chain_hashes, | 67 const HashValueVector& chain_hashes, |
| 68 base::TimeDelta* max_age, | 68 base::TimeDelta* max_age, |
| 69 bool* include_subdomains, | 69 bool* include_subdomains, |
| 70 HashValueVector* hashes, | 70 HashValueVector* hashes, |
| (...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1192 enforce = false; | 1192 enforce = false; |
| 1193 EXPECT_TRUE(ParseExpectCTHeader( | 1193 EXPECT_TRUE(ParseExpectCTHeader( |
| 1194 " max-age=999999999999999999999999999999999999999999999 ," | 1194 " max-age=999999999999999999999999999999999999999999999 ," |
| 1195 " enforce ", | 1195 " enforce ", |
| 1196 &max_age, &enforce, &report_uri)); | 1196 &max_age, &enforce, &report_uri)); |
| 1197 EXPECT_EQ(base::TimeDelta::FromSeconds(kMaxExpectCTAgeSecs), max_age); | 1197 EXPECT_EQ(base::TimeDelta::FromSeconds(kMaxExpectCTAgeSecs), max_age); |
| 1198 EXPECT_TRUE(enforce); | 1198 EXPECT_TRUE(enforce); |
| 1199 EXPECT_TRUE(report_uri.is_empty()); | 1199 EXPECT_TRUE(report_uri.is_empty()); |
| 1200 } | 1200 } |
| 1201 | 1201 |
| 1202 }; // namespace net | 1202 } // namespace net |
| OLD | NEW |