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 CHROMEOS_NETWORK_ONC_ONC_UTILS_H_ | 5 #ifndef CHROMEOS_NETWORK_ONC_ONC_UTILS_H_ |
6 #define CHROMEOS_NETWORK_ONC_ONC_UTILS_H_ | 6 #define CHROMEOS_NETWORK_ONC_ONC_UTILS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "chromeos/chromeos_export.h" | 12 #include "chromeos/chromeos_export.h" |
13 #include "chromeos/network/onc/onc_constants.h" | 13 #include "chromeos/network/onc/onc_constants.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class DictionaryValue; | 16 class DictionaryValue; |
| 17 class ListValue; |
17 } | 18 } |
18 | 19 |
19 namespace chromeos { | 20 namespace chromeos { |
20 namespace onc { | 21 namespace onc { |
21 | 22 |
22 struct OncValueSignature; | 23 struct OncValueSignature; |
23 | 24 |
24 // A valid but empty (no networks and no certificates) and unencrypted | 25 // A valid but empty (no networks and no certificates) and unencrypted |
25 // configuration. | 26 // configuration. |
26 CHROMEOS_EXPORT extern const char kEmptyUnencryptedConfiguration[]; | 27 CHROMEOS_EXPORT extern const char kEmptyUnencryptedConfiguration[]; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 base::DictionaryValue* onc_object); | 67 base::DictionaryValue* onc_object); |
67 | 68 |
68 // Creates a copy of |onc_object| with all values of sensitive fields replaced | 69 // Creates a copy of |onc_object| with all values of sensitive fields replaced |
69 // by |mask|. To find sensitive fields, signature and field name are checked | 70 // by |mask|. To find sensitive fields, signature and field name are checked |
70 // with the function FieldIsCredential(). | 71 // with the function FieldIsCredential(). |
71 CHROMEOS_EXPORT scoped_ptr<base::DictionaryValue> MaskCredentialsInOncObject( | 72 CHROMEOS_EXPORT scoped_ptr<base::DictionaryValue> MaskCredentialsInOncObject( |
72 const OncValueSignature& signature, | 73 const OncValueSignature& signature, |
73 const base::DictionaryValue& onc_object, | 74 const base::DictionaryValue& onc_object, |
74 const std::string& mask); | 75 const std::string& mask); |
75 | 76 |
| 77 // Decrypts |onc_blob| with |passphrase| if necessary. Clears |network_configs| |
| 78 // and |certificates| and fills them with the validated NetworkConfigurations |
| 79 // and Certificates of |onc_blob|. Returns false if any validation errors or |
| 80 // warnings occurred. Still, some networks or certificates might be added to the |
| 81 // output lists and should be further processed by the caller. |
| 82 CHROMEOS_EXPORT bool ParseAndValidateOncForImport( |
| 83 const std::string& onc_blob, |
| 84 chromeos::onc::ONCSource onc_source, |
| 85 const std::string& passphrase, |
| 86 base::ListValue* network_configs, |
| 87 base::ListValue* certificates); |
| 88 |
76 } // namespace onc | 89 } // namespace onc |
77 } // namespace chromeos | 90 } // namespace chromeos |
78 | 91 |
79 #endif // CHROMEOS_NETWORK_ONC_ONC_UTILS_H_ | 92 #endif // CHROMEOS_NETWORK_ONC_ONC_UTILS_H_ |
OLD | NEW |