| 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/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 return false; | 365 return false; |
| 366 } | 366 } |
| 367 | 367 |
| 368 // static | 368 // static |
| 369 bool TransportSecurityState::Deserialise( | 369 bool TransportSecurityState::Deserialise( |
| 370 const std::string& input, | 370 const std::string& input, |
| 371 bool* dirty, | 371 bool* dirty, |
| 372 std::map<std::string, DomainState>* out) { | 372 std::map<std::string, DomainState>* out) { |
| 373 scoped_ptr<Value> value( | 373 scoped_ptr<Value> value( |
| 374 base::JSONReader::Read(input, false /* do not allow trailing commas */)); | 374 base::JSONReader::Read(input, false /* do not allow trailing commas */)); |
| 375 if (!value.get() || !value->IsType(Value::TYPE_DICTIONARY)) | 375 if (!value.get() || !value->IsDictionary()) |
| 376 return false; | 376 return false; |
| 377 | 377 |
| 378 DictionaryValue* dict_value = reinterpret_cast<DictionaryValue*>(value.get()); | 378 DictionaryValue* dict_value = reinterpret_cast<DictionaryValue*>(value.get()); |
| 379 const base::Time current_time(base::Time::Now()); | 379 const base::Time current_time(base::Time::Now()); |
| 380 bool dirtied = false; | 380 bool dirtied = false; |
| 381 | 381 |
| 382 for (DictionaryValue::key_iterator i = dict_value->begin_keys(); | 382 for (DictionaryValue::key_iterator i = dict_value->begin_keys(); |
| 383 i != dict_value->end_keys(); ++i) { | 383 i != dict_value->end_keys(); ++i) { |
| 384 DictionaryValue* state; | 384 DictionaryValue* state; |
| 385 if (!dict_value->GetDictionaryWithoutPathExpansion(*i, &state)) | 385 if (!dict_value->GetDictionaryWithoutPathExpansion(*i, &state)) |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 } | 739 } |
| 740 | 740 |
| 741 LOG(ERROR) << "Rejecting public key chain for domain " << domain | 741 LOG(ERROR) << "Rejecting public key chain for domain " << domain |
| 742 << ". Validated chain: " << HashesToBase64String(hashes) | 742 << ". Validated chain: " << HashesToBase64String(hashes) |
| 743 << ", expected: " << HashesToBase64String(public_key_hashes); | 743 << ", expected: " << HashesToBase64String(public_key_hashes); |
| 744 | 744 |
| 745 return false; | 745 return false; |
| 746 } | 746 } |
| 747 | 747 |
| 748 } // namespace | 748 } // namespace |
| OLD | NEW |