| 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 c66abcf7b6415d9abd1f3b70363dea4c5e2b0b99..eecb316ae8b450e5148041071a2bf06be55c3824 100644
|
| --- a/chrome/utility/chrome_content_utility_client.cc
|
| +++ b/chrome/utility/chrome_content_utility_client.cc
|
| @@ -46,7 +46,9 @@
|
| #if defined(OS_WIN)
|
| #include "base/win/iat_patch_function.h"
|
| #include "base/win/scoped_handle.h"
|
| +#include "chrome/common/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)
|
| @@ -397,6 +399,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()
|
|
|
| @@ -899,4 +906,33 @@ 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, &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";
|
| + }
|
| + }
|
| +
|
| + Send(new ChromeUtilityHostMsg_GotEncryptedWiFiCredentials(
|
| + base64_encoded_ciphertext, error));
|
| +}
|
| +#endif // defined(OS_WIN)
|
| +
|
| } // namespace chrome
|
|
|