| 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 #ifndef CHROME_BROWSER_CHROMEOS_NETWORK_SETTINGS_ONC_UTILS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_NETWORK_SETTINGS_ONC_UTILS_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_NETWORK_SETTINGS_ONC_UTILS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_NETWORK_SETTINGS_ONC_UTILS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 | 11 |
| 12 namespace base { | 12 namespace base { |
| 13 class DictionaryValue; | 13 class DictionaryValue; |
| 14 } | 14 } |
| 15 | 15 |
| 16 namespace chromeos { | 16 namespace chromeos { |
| 17 namespace onc { | 17 namespace onc { |
| 18 | 18 |
| 19 // A valid but empty (no networks and no certificates) and unencrypted |
| 20 // configuration. |
| 21 extern const char kEmptyUnencryptedConfiguration[]; |
| 22 |
| 19 // Parses |json| according to the JSON format. If |json| is a JSON formatted | 23 // Parses |json| according to the JSON format. If |json| is a JSON formatted |
| 20 // dictionary, the function returns the dictionary as a DictionaryValue and | 24 // dictionary, the function returns the dictionary as a DictionaryValue and |
| 21 // doesn't modify |error|. Otherwise returns NULL and sets |error| to a | 25 // doesn't modify |error|. Otherwise returns NULL and sets |error| to a |
| 22 // translated error message. | 26 // translated error message. |
| 23 scoped_ptr<base::DictionaryValue> ReadDictionaryFromJson( | 27 scoped_ptr<base::DictionaryValue> ReadDictionaryFromJson( |
| 24 const std::string& json, | 28 const std::string& json, |
| 25 std::string* error); | 29 std::string* error); |
| 26 | 30 |
| 27 // Decrypt the given EncryptedConfiguration |onc| (see the ONC specification) | 31 // Decrypt the given EncryptedConfiguration |onc| (see the ONC specification) |
| 28 // using |passphrase|. The resulting UnencryptedConfiguration is returned and | 32 // using |passphrase|. The resulting UnencryptedConfiguration is returned and |
| 29 // |error| is not modified. If an error occurs, returns NULL and if additionally | 33 // |error| is not modified. If an error occurs, returns NULL and if additionally |
| 30 // |error| is not NULL, |error| is set to a user readable error message. | 34 // |error| is not NULL, |error| is set to a user readable error message. |
| 31 scoped_ptr<base::DictionaryValue> Decrypt(const std::string& passphrase, | 35 scoped_ptr<base::DictionaryValue> Decrypt(const std::string& passphrase, |
| 32 const base::DictionaryValue& onc, | 36 const base::DictionaryValue& onc, |
| 33 std::string* error); | 37 std::string* error); |
| 34 | 38 |
| 35 } // chromeos | 39 } // chromeos |
| 36 } // onc | 40 } // onc |
| 37 | 41 |
| 38 #endif // CHROME_BROWSER_CHROMEOS_NETWORK_SETTINGS_ONC_UTILS_H_ | 42 #endif // CHROME_BROWSER_CHROMEOS_NETWORK_SETTINGS_ONC_UTILS_H_ |
| OLD | NEW |