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
3 // found in the LICENSE file.
5 #ifndef CHROMEOS_NETWORK_ONC_ONC_UTILS_H_
6 #define CHROMEOS_NETWORK_ONC_ONC_UTILS_H_
10 #include "base/memory/scoped_ptr.h"
11 #include "chromeos/chromeos_export.h"
12 #include "chromeos/network/onc/onc_constants.h"
15 class DictionaryValue
;
21 // A valid but empty (no networks and no certificates) and unencrypted
23 CHROMEOS_EXPORT
extern const char kEmptyUnencryptedConfiguration
[];
25 // Parses |json| according to the JSON format. If |json| is a JSON formatted
26 // dictionary, the function returns the dictionary as a DictionaryValue.
27 // Otherwise returns NULL.
28 CHROMEOS_EXPORT scoped_ptr
<base::DictionaryValue
> ReadDictionaryFromJson(
29 const std::string
& json
);
31 // Decrypt the given EncryptedConfiguration |onc| (see the ONC specification)
32 // using |passphrase|. The resulting UnencryptedConfiguration is returned. If an
33 // error occurs, returns NULL.
34 CHROMEOS_EXPORT scoped_ptr
<base::DictionaryValue
> Decrypt(
35 const std::string
& passphrase
,
36 const base::DictionaryValue
& onc
);
38 // For logging only: strings not user facing.
39 CHROMEOS_EXPORT
std::string
GetSourceAsString(ONCSource source
);
44 #endif // CHROMEOS_NETWORK_ONC_ONC_UTILS_H_