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 <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 base::ListValue* network_configs); | 83 base::ListValue* network_configs); |
84 | 84 |
85 // Creates a copy of |onc_object| with all values of sensitive fields replaced | 85 // Creates a copy of |onc_object| with all values of sensitive fields replaced |
86 // by |mask|. To find sensitive fields, signature and field name are checked | 86 // by |mask|. To find sensitive fields, signature and field name are checked |
87 // with the function FieldIsCredential(). | 87 // with the function FieldIsCredential(). |
88 CHROMEOS_EXPORT scoped_ptr<base::DictionaryValue> MaskCredentialsInOncObject( | 88 CHROMEOS_EXPORT scoped_ptr<base::DictionaryValue> MaskCredentialsInOncObject( |
89 const OncValueSignature& signature, | 89 const OncValueSignature& signature, |
90 const base::DictionaryValue& onc_object, | 90 const base::DictionaryValue& onc_object, |
91 const std::string& mask); | 91 const std::string& mask); |
92 | 92 |
93 // Decrypts |onc_blob| with |passphrase| if necessary. Clears |network_configs| | 93 // Decrypts |onc_blob| with |passphrase| if necessary. Clears |network_configs|, |
94 // and |certificates| and fills them with the validated NetworkConfigurations | 94 // |global_network_config| and |certificates| and fills them with the validated |
95 // and Certificates of |onc_blob|. Returns false if any validation errors or | 95 // NetworkConfigurations, GlobalNetworkConfiguration and Certificates of |
96 // warnings occurred. Still, some networks or certificates might be added to the | 96 // |onc_blob|. Returns false if any validation errors or warnings occurred. |
97 // output lists and should be further processed by the caller. | 97 // Still, some configuration might be added to the output arguments and should |
| 98 // be further processed by the caller. |
98 CHROMEOS_EXPORT bool ParseAndValidateOncForImport( | 99 CHROMEOS_EXPORT bool ParseAndValidateOncForImport( |
99 const std::string& onc_blob, | 100 const std::string& onc_blob, |
100 ::onc::ONCSource onc_source, | 101 ::onc::ONCSource onc_source, |
101 const std::string& passphrase, | 102 const std::string& passphrase, |
102 base::ListValue* network_configs, | 103 base::ListValue* network_configs, |
| 104 base::DictionaryValue* global_network_config, |
103 base::ListValue* certificates); | 105 base::ListValue* certificates); |
104 | 106 |
105 // Parse the given PEM encoded certificate |pem_encoded| and create a | 107 // Parse the given PEM encoded certificate |pem_encoded| and create a |
106 // X509Certificate from it. | 108 // X509Certificate from it. |
107 CHROMEOS_EXPORT scoped_refptr<net::X509Certificate> DecodePEMCertificate( | 109 CHROMEOS_EXPORT scoped_refptr<net::X509Certificate> DecodePEMCertificate( |
108 const std::string& pem_encoded); | 110 const std::string& pem_encoded); |
109 | 111 |
110 // Replaces all references by GUID to Server or CA certs by their PEM | 112 // Replaces all references by GUID to Server or CA certs by their PEM |
111 // encoding. Returns true if all references could be resolved. Otherwise returns | 113 // encoding. Returns true if all references could be resolved. Otherwise returns |
112 // false and network configurations with unresolveable references are removed | 114 // false and network configurations with unresolveable references are removed |
113 // from |network_configs|. |network_configs| must be a list of ONC | 115 // from |network_configs|. |network_configs| must be a list of ONC |
114 // NetworkConfiguration dictionaries. | 116 // NetworkConfiguration dictionaries. |
115 CHROMEOS_EXPORT bool ResolveServerCertRefsInNetworks( | 117 CHROMEOS_EXPORT bool ResolveServerCertRefsInNetworks( |
116 const CertPEMsByGUIDMap& certs_by_guid, | 118 const CertPEMsByGUIDMap& certs_by_guid, |
117 base::ListValue* network_configs); | 119 base::ListValue* network_configs); |
118 | 120 |
119 // Replaces all references by GUID to Server or CA certs by their PEM | 121 // Replaces all references by GUID to Server or CA certs by their PEM |
120 // encoding. Returns true if all references could be resolved. |network_config| | 122 // encoding. Returns true if all references could be resolved. |network_config| |
121 // must be a ONC NetworkConfiguration. | 123 // must be a ONC NetworkConfiguration. |
122 CHROMEOS_EXPORT bool ResolveServerCertRefsInNetwork( | 124 CHROMEOS_EXPORT bool ResolveServerCertRefsInNetwork( |
123 const CertPEMsByGUIDMap& certs_by_guid, | 125 const CertPEMsByGUIDMap& certs_by_guid, |
124 base::DictionaryValue* network_config); | 126 base::DictionaryValue* network_config); |
125 | 127 |
126 } // namespace onc | 128 } // namespace onc |
127 } // namespace chromeos | 129 } // namespace chromeos |
128 | 130 |
129 #endif // CHROMEOS_NETWORK_ONC_ONC_UTILS_H_ | 131 #endif // CHROMEOS_NETWORK_ONC_ONC_UTILS_H_ |
OLD | NEW |