| 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 "net/http/transport_security_state.h" | 5 #include "net/http/transport_security_state.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1618 while (*sha256_hash) { | 1618 while (*sha256_hash) { |
| 1619 AddHash(*sha256_hash, &pkp_state->bad_spki_hashes); | 1619 AddHash(*sha256_hash, &pkp_state->bad_spki_hashes); |
| 1620 sha256_hash++; | 1620 sha256_hash++; |
| 1621 } | 1621 } |
| 1622 } | 1622 } |
| 1623 } | 1623 } |
| 1624 | 1624 |
| 1625 return true; | 1625 return true; |
| 1626 } | 1626 } |
| 1627 | 1627 |
| 1628 bool TransportSecurityState::IsGooglePinnedHost(const std::string& host) const { | |
| 1629 DCHECK(CalledOnValidThread()); | |
| 1630 | |
| 1631 if (!IsBuildTimely()) | |
| 1632 return false; | |
| 1633 | |
| 1634 PreloadResult result; | |
| 1635 if (!DecodeHSTSPreload(host, &result)) | |
| 1636 return false; | |
| 1637 | |
| 1638 if (!result.has_pins) | |
| 1639 return false; | |
| 1640 | |
| 1641 if (result.pinset_id >= arraysize(kPinsets)) | |
| 1642 return false; | |
| 1643 | |
| 1644 return kPinsets[result.pinset_id].accepted_pins == kGoogleAcceptableCerts; | |
| 1645 } | |
| 1646 | |
| 1647 bool TransportSecurityState::GetDynamicSTSState(const std::string& host, | 1628 bool TransportSecurityState::GetDynamicSTSState(const std::string& host, |
| 1648 STSState* result) { | 1629 STSState* result) { |
| 1649 DCHECK(CalledOnValidThread()); | 1630 DCHECK(CalledOnValidThread()); |
| 1650 | 1631 |
| 1651 const std::string canonicalized_host = CanonicalizeHost(host); | 1632 const std::string canonicalized_host = CanonicalizeHost(host); |
| 1652 if (canonicalized_host.empty()) | 1633 if (canonicalized_host.empty()) |
| 1653 return false; | 1634 return false; |
| 1654 | 1635 |
| 1655 base::Time current_time(base::Time::Now()); | 1636 base::Time current_time(base::Time::Now()); |
| 1656 | 1637 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1862 TransportSecurityState::PKPStateIterator::PKPStateIterator( | 1843 TransportSecurityState::PKPStateIterator::PKPStateIterator( |
| 1863 const TransportSecurityState& state) | 1844 const TransportSecurityState& state) |
| 1864 : iterator_(state.enabled_pkp_hosts_.begin()), | 1845 : iterator_(state.enabled_pkp_hosts_.begin()), |
| 1865 end_(state.enabled_pkp_hosts_.end()) { | 1846 end_(state.enabled_pkp_hosts_.end()) { |
| 1866 } | 1847 } |
| 1867 | 1848 |
| 1868 TransportSecurityState::PKPStateIterator::~PKPStateIterator() { | 1849 TransportSecurityState::PKPStateIterator::~PKPStateIterator() { |
| 1869 } | 1850 } |
| 1870 | 1851 |
| 1871 } // namespace net | 1852 } // namespace net |
| OLD | NEW |