| Index: chrome/utility/chrome_content_utility_client.cc
|
| diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc
|
| index 9c883f5161fb9b962c82f314a635035691fdaf93..1c44c8a121cdedc1af13db82cb1fd75476de9654 100644
|
| --- a/chrome/utility/chrome_content_utility_client.cc
|
| +++ b/chrome/utility/chrome_content_utility_client.cc
|
| @@ -44,7 +44,9 @@
|
| #if defined(OS_WIN)
|
| #include "base/win/iat_patch_function.h"
|
| #include "base/win/scoped_handle.h"
|
| +#include "chrome/browser/extensions/api/networking_private/networking_private_crypto.h"
|
| #include "chrome/utility/media_galleries/itunes_pref_parser_win.h"
|
| +#include "components/wifi/wifi_service.h"
|
| #include "printing/emf_win.h"
|
| #include "ui/gfx/gdi_util.h"
|
| #endif // defined(OS_WIN)
|
| @@ -381,6 +383,11 @@ bool ChromeContentUtilityClient::OnMessageReceived(
|
| OnIndexPicasaAlbumsContents)
|
| #endif // defined(OS_WIN) || defined(OS_MACOSX)
|
|
|
| +#if defined(OS_WIN)
|
| + IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_GetAndEncryptWiFiCredentials,
|
| + OnGetAndEncryptWiFiCredentials)
|
| +#endif // defined(OS_WIN)
|
| +
|
| IPC_MESSAGE_UNHANDLED(handled = false)
|
| IPC_END_MESSAGE_MAP()
|
|
|
| @@ -860,4 +867,40 @@ void ChromeContentUtilityClient::OnIndexPicasaAlbumsContents(
|
| }
|
| #endif // defined(OS_WIN) || defined(OS_MACOSX)
|
|
|
| +#if defined(OS_WIN)
|
| +void ChromeContentUtilityClient::OnGetAndEncryptWiFiCredentials(
|
| + const std::string& network_guid,
|
| + const std::string& public_key) {
|
| + scoped_ptr<wifi::WiFiService> wifi_service(wifi::WiFiService::Create());
|
| + wifi_service->Initialize(NULL);
|
| +
|
| + std::string key_data;
|
| + std::string error;
|
| + wifi_service->GetKeyFromSystem(network_guid, true, &key_data, &error);
|
| +
|
| + std::string base64_encoded_ciphertext;
|
| + if (error.empty() && !key_data.empty()) {
|
| + NetworkingPrivateCrypto crypto;
|
| + std::string ciphertext;
|
| + bool encrypted = crypto.EncryptByteString(public_key,
|
| + key_data,
|
| + &ciphertext);
|
| + if (encrypted) {
|
| + base::Base64Encode(ciphertext, &base64_encoded_ciphertext);
|
| + } else {
|
| + error = "Error.EncryptByteString";
|
| + }
|
| + }
|
| +
|
| + bool test = true;
|
| + if (test) {
|
| + error = "";
|
| + base64_encoded_ciphertext = "encrypted_credentials";
|
| + }
|
| +
|
| + Send(new ChromeUtilityHostMsg_GotEncryptedWiFiCredentials(
|
| + base64_encoded_ciphertext, error));
|
| +}
|
| +#endif // defined(OS_WIN)
|
| +
|
| } // namespace chrome
|
|
|