| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "net/base/transport_security_state.h" | 5 #include "net/base/transport_security_state.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 {22, false, "\010business\007twitter\003com"}, | 552 {22, false, "\010business\007twitter\003com"}, |
| 553 #endif | 553 #endif |
| 554 }; | 554 }; |
| 555 static const size_t kNumPreloadedSTS = ARRAYSIZE_UNSAFE(kPreloadedSTS); | 555 static const size_t kNumPreloadedSTS = ARRAYSIZE_UNSAFE(kPreloadedSTS); |
| 556 | 556 |
| 557 static const struct { | 557 static const struct { |
| 558 uint8 length; | 558 uint8 length; |
| 559 bool include_subdomains; | 559 bool include_subdomains; |
| 560 char dns_name[30]; | 560 char dns_name[30]; |
| 561 } kPreloadedSNISTS[] = { | 561 } kPreloadedSNISTS[] = { |
| 562 {11, true, "\005gmail\003com"}, | 562 {11, false, "\005gmail\003com"}, |
| 563 {16, true, "\012googlemail\003com"}, | 563 {16, false, "\012googlemail\003com"}, |
| 564 {15, false, "\003www\005gmail\003com"}, |
| 565 {20, false, "\003www\012googlemail\003com"}, |
| 564 }; | 566 }; |
| 565 static const size_t kNumPreloadedSNISTS = ARRAYSIZE_UNSAFE(kPreloadedSNISTS); | 567 static const size_t kNumPreloadedSNISTS = ARRAYSIZE_UNSAFE(kPreloadedSNISTS); |
| 566 | 568 |
| 567 for (size_t i = 0; canonicalized_host[i]; i += canonicalized_host[i] + 1) { | 569 for (size_t i = 0; canonicalized_host[i]; i += canonicalized_host[i] + 1) { |
| 568 std::string host_sub_chunk(&canonicalized_host[i], | 570 std::string host_sub_chunk(&canonicalized_host[i], |
| 569 canonicalized_host.size() - i); | 571 canonicalized_host.size() - i); |
| 570 out->domain = DNSDomainToString(host_sub_chunk); | 572 out->domain = DNSDomainToString(host_sub_chunk); |
| 571 std::string hashed_host(HashHost(host_sub_chunk)); | 573 std::string hashed_host(HashHost(host_sub_chunk)); |
| 572 if (hosts.find(hashed_host) != hosts.end()) { | 574 if (hosts.find(hashed_host) != hosts.end()) { |
| 573 *out = hosts[hashed_host]; | 575 *out = hosts[hashed_host]; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 } | 644 } |
| 643 | 645 |
| 644 LOG(ERROR) << "Rejecting public key chain for domain " << domain | 646 LOG(ERROR) << "Rejecting public key chain for domain " << domain |
| 645 << ". Validated chain: " << HashesToBase64String(hashes) | 647 << ". Validated chain: " << HashesToBase64String(hashes) |
| 646 << ", expected: " << HashesToBase64String(public_key_hashes); | 648 << ", expected: " << HashesToBase64String(public_key_hashes); |
| 647 | 649 |
| 648 return false; | 650 return false; |
| 649 } | 651 } |
| 650 | 652 |
| 651 } // namespace | 653 } // namespace |
| OLD | NEW |