Chromium Code Reviews| 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 <string> | 9 #include <string> |
| 10 #include <vector> | |
| 9 | 11 |
| 10 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 11 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 13 #include "chromeos/chromeos_export.h" | 15 #include "chromeos/chromeos_export.h" |
| 14 #include "chromeos/network/onc/onc_constants.h" | 16 #include "chromeos/network/onc/onc_constants.h" |
| 15 #include "net/cert/x509_certificate.h" | |
| 16 | 17 |
| 17 namespace base { | 18 namespace base { |
| 18 class DictionaryValue; | 19 class DictionaryValue; |
| 19 class ListValue; | 20 class ListValue; |
| 20 } | 21 } |
| 21 | 22 |
| 23 namespace net { | |
| 24 class X509Certificate; | |
| 25 } | |
| 26 | |
| 22 namespace chromeos { | 27 namespace chromeos { |
| 23 namespace onc { | 28 namespace onc { |
| 24 | 29 |
| 25 struct OncValueSignature; | 30 struct OncValueSignature; |
| 26 | 31 |
| 27 // A valid but empty (no networks and no certificates) and unencrypted | 32 // A valid but empty (no networks and no certificates) and unencrypted |
| 28 // configuration. | 33 // configuration. |
| 29 CHROMEOS_EXPORT extern const char kEmptyUnencryptedConfiguration[]; | 34 CHROMEOS_EXPORT extern const char kEmptyUnencryptedConfiguration[]; |
| 30 | 35 |
| 31 // Parses |json| according to the JSON format. If |json| is a JSON formatted | 36 // Parses |json| according to the JSON format. If |json| is a JSON formatted |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 CHROMEOS_EXPORT bool ParseAndValidateOncForImport( | 89 CHROMEOS_EXPORT bool ParseAndValidateOncForImport( |
| 85 const std::string& onc_blob, | 90 const std::string& onc_blob, |
| 86 ONCSource onc_source, | 91 ONCSource onc_source, |
| 87 const std::string& passphrase, | 92 const std::string& passphrase, |
| 88 base::ListValue* network_configs, | 93 base::ListValue* network_configs, |
| 89 base::ListValue* certificates); | 94 base::ListValue* certificates); |
| 90 | 95 |
| 91 // Parse the given PEM encoded certificate |pem_encoded| and create a | 96 // Parse the given PEM encoded certificate |pem_encoded| and create a |
| 92 // X509Certificate from it. | 97 // X509Certificate from it. |
| 93 CHROMEOS_EXPORT scoped_refptr<net::X509Certificate> DecodePEMCertificate( | 98 CHROMEOS_EXPORT scoped_refptr<net::X509Certificate> DecodePEMCertificate( |
| 94 const std::string& pem_encoded, | 99 const std::string& pem_encoded); |
| 95 const std::string& nickname); | 100 |
| 101 // Replaces all references by GUID to Server or CA certs by their PEM | |
| 102 // encoding. Returns true if all references could be resolved. Otherwise returns | |
| 103 // false and network configurations with unresolveable references are removed | |
| 104 // from |network_configs|. |network_configs| must be a list of ONC | |
| 105 // NetworkConfiguration dictionaries. | |
| 106 CHROMEOS_EXPORT bool ResolveServerCertRefsInNetworks( | |
| 107 const std::map<std::string, | |
| 108 scoped_refptr<net::X509Certificate> >& certs_by_guid, | |
|
stevenjb
2013/06/28 18:00:27
These should use a typedef
pneubeck (no reviews)
2013/07/01 15:12:14
Done.
| |
| 109 base::ListValue* network_configs); | |
| 110 | |
| 111 // Replaces all references by GUID to Server or CA certs by their PEM | |
| 112 // encoding. Returns true if all references could be resolved. |network_config| | |
| 113 // must be a ONC NetworkConfiguration. | |
| 114 CHROMEOS_EXPORT bool ResolveServerCertRefsInNetwork( | |
| 115 const std::map<std::string, | |
| 116 scoped_refptr<net::X509Certificate> >& certs_by_guid, | |
| 117 base::DictionaryValue* network_config); | |
| 96 | 118 |
| 97 } // namespace onc | 119 } // namespace onc |
| 98 } // namespace chromeos | 120 } // namespace chromeos |
| 99 | 121 |
| 100 #endif // CHROMEOS_NETWORK_ONC_ONC_UTILS_H_ | 122 #endif // CHROMEOS_NETWORK_ONC_ONC_UTILS_H_ |
| OLD | NEW |