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

Unified Diff: chrome/utility/chrome_content_utility_client.cc

Issue 102993002: Implement Networking Private API VerifyAndEncryptCredentials method (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Implement GetWiFiPasswordFromSystem on Mac. Created 6 years, 10 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 | « chrome/utility/chrome_content_utility_client.h ('k') | components/wifi/fake_wifi_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..0fdfbbf2e27fd4300cb5f833f1d5181fceaed5a8 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_GetAndEncryptWiFiPassphrase,
+ OnGetAndEncryptWiFiPassphrase)
+#endif // defined(OS_WIN)
+
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -860,4 +867,41 @@ void ChromeContentUtilityClient::OnIndexPicasaAlbumsContents(
}
#endif // defined(OS_WIN) || defined(OS_MACOSX)
+#if defined(OS_WIN)
+void ChromeContentUtilityClient::OnGetAndEncryptWiFiPassphrase(
+ int32 callback_id,
+ const std::string& network_guid,
+ const std::string& public_key) {
+ scoped_ptr<wifi::WiFiService> wifi_service(wifi::WiFiService::Create());
+ wifi_service->Initialize(NULL);
tbarzic 2014/02/07 19:25:00 hm, wifi_service does much more than we need. Can
mef 2014/02/07 19:53:31 Yes and no. One of important functions of WiFiServ
tbarzic 2014/02/07 22:43:02 OK then. Though it would be nice if we prevented t
tbarzic 2014/02/21 19:02:51 I think you missed this comment :)
mef 2014/02/25 19:57:59 Sorry, you are right. I've moved call to WlanRegis
+
+ std::string passphrase;
+ std::string error;
+ wifi_service->GetPassphraseFromSystem(network_guid, &passphrase, &error);
+
+ std::string base64_encoded_ciphertext;
+ if (error.empty() && !passphrase.empty()) {
+ NetworkingPrivateCrypto crypto;
+ std::string ciphertext;
+ bool encrypted = crypto.EncryptByteString(public_key,
+ passphrase,
+ &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_GotEncryptedWiFiPassphrase(
+ callback_id, base64_encoded_ciphertext, error));
+}
+#endif // defined(OS_WIN)
+
} // namespace chrome
« no previous file with comments | « chrome/utility/chrome_content_utility_client.h ('k') | components/wifi/fake_wifi_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698