| 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 "chromeos/network/onc/onc_utils.h" | 5 #include "chromeos/network/onc/onc_utils.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/logging.h" | 9 #include "base/logging.h" | 
|  | 10 #include "base/macros.h" | 
| 10 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" | 
| 11 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" | 
| 12 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" | 
| 13 #include "base/values.h" | 14 #include "base/values.h" | 
| 14 #include "chromeos/network/network_event_log.h" | 15 #include "chromeos/network/network_event_log.h" | 
| 15 #include "chromeos/network/onc/onc_mapper.h" | 16 #include "chromeos/network/onc/onc_mapper.h" | 
| 16 #include "chromeos/network/onc/onc_signature.h" | 17 #include "chromeos/network/onc/onc_signature.h" | 
| 17 #include "chromeos/network/onc/onc_utils.h" | 18 #include "chromeos/network/onc/onc_utils.h" | 
| 18 #include "chromeos/network/onc/onc_validator.h" | 19 #include "chromeos/network/onc/onc_validator.h" | 
| 19 #include "components/device_event_log/device_event_log.h" | 20 #include "components/device_event_log/device_event_log.h" | 
| (...skipping 21 matching lines...) Expand all  Loading... | 
| 41 | 42 | 
| 42 }  // namespace | 43 }  // namespace | 
| 43 | 44 | 
| 44 const char kEmptyUnencryptedConfiguration[] = | 45 const char kEmptyUnencryptedConfiguration[] = | 
| 45     "{\"Type\":\"UnencryptedConfiguration\",\"NetworkConfigurations\":[]," | 46     "{\"Type\":\"UnencryptedConfiguration\",\"NetworkConfigurations\":[]," | 
| 46     "\"Certificates\":[]}"; | 47     "\"Certificates\":[]}"; | 
| 47 | 48 | 
| 48 scoped_ptr<base::DictionaryValue> ReadDictionaryFromJson( | 49 scoped_ptr<base::DictionaryValue> ReadDictionaryFromJson( | 
| 49     const std::string& json) { | 50     const std::string& json) { | 
| 50   std::string error; | 51   std::string error; | 
| 51   base::Value* root = base::JSONReader::DeprecatedReadAndReturnError( | 52   scoped_ptr<base::Value> root = base::JSONReader::ReadAndReturnError( | 
| 52       json, base::JSON_ALLOW_TRAILING_COMMAS, nullptr, &error); | 53       json, base::JSON_ALLOW_TRAILING_COMMAS, nullptr, &error); | 
| 53 | 54 | 
| 54   base::DictionaryValue* dict_ptr = nullptr; | 55   base::DictionaryValue* dict_ptr = nullptr; | 
| 55   if (!root || !root->GetAsDictionary(&dict_ptr)) { | 56   if (!root || !root->GetAsDictionary(&dict_ptr)) { | 
| 56     NET_LOG(ERROR) << "Invalid JSON Dictionary: " << error; | 57     NET_LOG(ERROR) << "Invalid JSON Dictionary: " << error; | 
| 57     delete root; | 58     return nullptr; | 
| 58   } | 59   } | 
| 59 | 60   ignore_result(root.release()); | 
| 60   return make_scoped_ptr(dict_ptr); | 61   return make_scoped_ptr(dict_ptr); | 
| 61 } | 62 } | 
| 62 | 63 | 
| 63 scoped_ptr<base::DictionaryValue> Decrypt(const std::string& passphrase, | 64 scoped_ptr<base::DictionaryValue> Decrypt(const std::string& passphrase, | 
| 64                                           const base::DictionaryValue& root) { | 65                                           const base::DictionaryValue& root) { | 
| 65   const int kKeySizeInBits = 256; | 66   const int kKeySizeInBits = 256; | 
| 66   const int kMaxIterationCount = 500000; | 67   const int kMaxIterationCount = 500000; | 
| 67   std::string onc_type; | 68   std::string onc_type; | 
| 68   std::string initial_vector; | 69   std::string initial_vector; | 
| 69   std::string salt; | 70   std::string salt; | 
| (...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 979     default: { | 980     default: { | 
| 980       LOG(ERROR) << "Unexpected proxy mode in Shill config: " << mode; | 981       LOG(ERROR) << "Unexpected proxy mode in Shill config: " << mode; | 
| 981       return nullptr; | 982       return nullptr; | 
| 982     } | 983     } | 
| 983   } | 984   } | 
| 984   return proxy_settings.Pass(); | 985   return proxy_settings.Pass(); | 
| 985 } | 986 } | 
| 986 | 987 | 
| 987 }  // namespace onc | 988 }  // namespace onc | 
| 988 }  // namespace chromeos | 989 }  // namespace chromeos | 
| OLD | NEW | 
|---|