| 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 <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1093 while (*sha256_hash) { | 1093 while (*sha256_hash) { |
| 1094 AddHash(*sha256_hash, &pkp_state->bad_spki_hashes); | 1094 AddHash(*sha256_hash, &pkp_state->bad_spki_hashes); |
| 1095 sha256_hash++; | 1095 sha256_hash++; |
| 1096 } | 1096 } |
| 1097 } | 1097 } |
| 1098 } | 1098 } |
| 1099 | 1099 |
| 1100 return true; | 1100 return true; |
| 1101 } | 1101 } |
| 1102 | 1102 |
| 1103 bool TransportSecurityState::IsGooglePinnedHost(const std::string& host) const { | |
| 1104 DCHECK(CalledOnValidThread()); | |
| 1105 | |
| 1106 if (!IsBuildTimely()) | |
| 1107 return false; | |
| 1108 | |
| 1109 PreloadResult result; | |
| 1110 if (!DecodeHSTSPreload(host, &result)) | |
| 1111 return false; | |
| 1112 | |
| 1113 if (!result.has_pins) | |
| 1114 return false; | |
| 1115 | |
| 1116 if (result.pinset_id >= arraysize(kPinsets)) | |
| 1117 return false; | |
| 1118 | |
| 1119 return kPinsets[result.pinset_id].accepted_pins == kGoogleAcceptableCerts; | |
| 1120 } | |
| 1121 | |
| 1122 bool TransportSecurityState::GetStaticExpectCTState( | 1103 bool TransportSecurityState::GetStaticExpectCTState( |
| 1123 const std::string& host, | 1104 const std::string& host, |
| 1124 ExpectCTState* expect_ct_state) const { | 1105 ExpectCTState* expect_ct_state) const { |
| 1125 DCHECK(CalledOnValidThread()); | 1106 DCHECK(CalledOnValidThread()); |
| 1126 | 1107 |
| 1127 if (!IsBuildTimely()) | 1108 if (!IsBuildTimely()) |
| 1128 return false; | 1109 return false; |
| 1129 | 1110 |
| 1130 PreloadResult result; | 1111 PreloadResult result; |
| 1131 if (!DecodeHSTSPreload(host, &result)) | 1112 if (!DecodeHSTSPreload(host, &result)) |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1318 TransportSecurityState::PKPStateIterator::PKPStateIterator( | 1299 TransportSecurityState::PKPStateIterator::PKPStateIterator( |
| 1319 const TransportSecurityState& state) | 1300 const TransportSecurityState& state) |
| 1320 : iterator_(state.enabled_pkp_hosts_.begin()), | 1301 : iterator_(state.enabled_pkp_hosts_.begin()), |
| 1321 end_(state.enabled_pkp_hosts_.end()) { | 1302 end_(state.enabled_pkp_hosts_.end()) { |
| 1322 } | 1303 } |
| 1323 | 1304 |
| 1324 TransportSecurityState::PKPStateIterator::~PKPStateIterator() { | 1305 TransportSecurityState::PKPStateIterator::~PKPStateIterator() { |
| 1325 } | 1306 } |
| 1326 | 1307 |
| 1327 } // namespace | 1308 } // namespace |
| OLD | NEW |