Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(847)

Unified Diff: chromeos/network/onc/onc_utils.h

Issue 16946002: Resolve certificate references in ONC by PEM. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added a unit test for the resolve function. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/network/onc/onc_translator_unittest.cc ('k') | chromeos/network/onc/onc_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/network/onc/onc_utils.h
diff --git a/chromeos/network/onc/onc_utils.h b/chromeos/network/onc/onc_utils.h
index d604cfc67a755252ffa17a2d988619db718514b4..f077aeb771e1cd61021e8a27ca2e5dfcdf312323 100644
--- a/chromeos/network/onc/onc_utils.h
+++ b/chromeos/network/onc/onc_utils.h
@@ -5,20 +5,25 @@
#ifndef CHROMEOS_NETWORK_ONC_ONC_UTILS_H_
#define CHROMEOS_NETWORK_ONC_ONC_UTILS_H_
+#include <map>
#include <string>
+#include <vector>
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "chromeos/chromeos_export.h"
#include "chromeos/network/onc/onc_constants.h"
-#include "net/cert/x509_certificate.h"
namespace base {
class DictionaryValue;
class ListValue;
}
+namespace net {
+class X509Certificate;
+}
+
namespace chromeos {
namespace onc {
@@ -28,6 +33,9 @@ struct OncValueSignature;
// configuration.
CHROMEOS_EXPORT extern const char kEmptyUnencryptedConfiguration[];
+typedef std::map<std::string,
+ scoped_refptr<net::X509Certificate> > CertsByGUIDMap;
+
// Parses |json| according to the JSON format. If |json| is a JSON formatted
// dictionary, the function returns the dictionary as a DictionaryValue.
// Otherwise returns NULL.
@@ -91,8 +99,23 @@ CHROMEOS_EXPORT bool ParseAndValidateOncForImport(
// Parse the given PEM encoded certificate |pem_encoded| and create a
// X509Certificate from it.
CHROMEOS_EXPORT scoped_refptr<net::X509Certificate> DecodePEMCertificate(
- const std::string& pem_encoded,
- const std::string& nickname);
+ const std::string& pem_encoded);
+
+// Replaces all references by GUID to Server or CA certs by their PEM
+// encoding. Returns true if all references could be resolved. Otherwise returns
+// false and network configurations with unresolveable references are removed
+// from |network_configs|. |network_configs| must be a list of ONC
+// NetworkConfiguration dictionaries.
+CHROMEOS_EXPORT bool ResolveServerCertRefsInNetworks(
+ const CertsByGUIDMap& certs_by_guid,
+ base::ListValue* network_configs);
+
+// Replaces all references by GUID to Server or CA certs by their PEM
+// encoding. Returns true if all references could be resolved. |network_config|
+// must be a ONC NetworkConfiguration.
+CHROMEOS_EXPORT bool ResolveServerCertRefsInNetwork(
+ const CertsByGUIDMap& certs_by_guid,
+ base::DictionaryValue* network_config);
} // namespace onc
} // namespace chromeos
« no previous file with comments | « chromeos/network/onc/onc_translator_unittest.cc ('k') | chromeos/network/onc/onc_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698