Index: chromeos/network/onc/onc_utils.h |
diff --git a/chromeos/network/onc/onc_utils.h b/chromeos/network/onc/onc_utils.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..36c4380f7c8894ed232b04e05de51e59e69ddcc4 |
--- /dev/null |
+++ b/chromeos/network/onc/onc_utils.h |
@@ -0,0 +1,50 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROMEOS_NETWORK_ONC_ONC_UTILS_H_ |
+#define CHROMEOS_NETWORK_ONC_ONC_UTILS_H_ |
+ |
+#include <string> |
+ |
+#include "base/memory/scoped_ptr.h" |
+#include "chromeos/chromeos_export.h" |
+ |
+namespace base { |
+class DictionaryValue; |
+} |
+ |
+namespace chromeos { |
+namespace onc { |
+ |
+CHROMEOS_EXPORT extern const char kResultSuccess[]; |
+CHROMEOS_EXPORT extern const char kErrorNotAJsonDictionary[]; |
+CHROMEOS_EXPORT extern const char kErrorEncryptedOncMalformed[]; |
+CHROMEOS_EXPORT extern const char kErrorEncryptedOncUnsupportedEncryption[]; |
+CHROMEOS_EXPORT extern const char kErrorEncryptedOncUnableToDecrypt[]; |
+CHROMEOS_EXPORT extern const char kErrorEncryptedOncTooManyIterations[]; |
+CHROMEOS_EXPORT extern const char kErrorEncryptedOncUnableToDecode[]; |
+CHROMEOS_EXPORT extern const char kErrorPropertyDictionaryMalformed[]; |
+ |
+// Parses |json| according to the JSON format. If |json| is a JSON formatted |
+// dictionary, the function returns the dictionary as a DictionaryValue and |
+// doesn't modify |error|. Otherwise returns NULL and sets |error| to a |
pneubeck (no reviews)
2012/12/04 10:43:56
|error| -> |result|
Greg Spencer (Chromium)
2012/12/07 18:12:27
Removed error.
|
+// non-user-facing (untranslated) error message. |
+CHROMEOS_EXPORT scoped_ptr<base::DictionaryValue> ReadDictionaryFromJson( |
+ const std::string& json, |
+ std::string* result); |
+ |
+// Decrypt the given EncryptedConfiguration |onc| (see the ONC specification) |
+// using |passphrase|. The resulting UnencryptedConfiguration is returned and |
+// |error| is not modified. If an error occurs, returns NULL and if additionally |
pneubeck (no reviews)
2012/12/04 10:43:56
|error| is always modified if not-null.
Greg Spencer (Chromium)
2012/12/07 18:12:27
removed error
|
+// |error| is not NULL, |error| is set to a non-user-facing (untranslated) error |
pneubeck (no reviews)
2012/12/04 10:43:56
|error| -> |result|
Greg Spencer (Chromium)
2012/12/07 18:12:27
removed error
|
+// message. |
+CHROMEOS_EXPORT scoped_ptr<base::DictionaryValue> Decrypt( |
+ const std::string& passphrase, |
+ const base::DictionaryValue& onc, |
+ std::string* result); |
+ |
+} // chromeos |
+} // onc |
+ |
+#endif // CHROMEOS_NETWORK_ONC_ONC_UTILS_H_ |