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

Unified Diff: remoting/host/plugin/host_script_object.cc

Issue 10243011: [Chromoting] Factor out common code for pin hashing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review. Created 8 years, 8 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
Index: remoting/host/plugin/host_script_object.cc
diff --git a/remoting/host/plugin/host_script_object.cc b/remoting/host/plugin/host_script_object.cc
index 74f9c161642314ac2cef21f2856b012ea16bc8bc..f2521cf7a2054b26bd5b7360d803a8b2801defec 100644
--- a/remoting/host/plugin/host_script_object.cc
+++ b/remoting/host/plugin/host_script_object.cc
@@ -4,7 +4,6 @@
#include "remoting/host/plugin/host_script_object.h"
-#include "base/base64.h"
#include "base/bind.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
@@ -23,12 +22,12 @@
#include "remoting/host/host_key_pair.h"
#include "remoting/host/host_secret.h"
#include "remoting/host/it2me_host_user_interface.h"
+#include "remoting/host/pin_hash.h"
#include "remoting/host/plugin/daemon_controller.h"
#include "remoting/host/plugin/host_log_handler.h"
#include "remoting/host/policy_hack/nat_policy.h"
#include "remoting/host/register_support_host_request.h"
#include "remoting/jingle_glue/xmpp_signal_strategy.h"
-#include "remoting/protocol/authentication_method.h"
#include "remoting/protocol/it2me_host_authenticator_factory.h"
namespace remoting {
@@ -636,15 +635,7 @@ bool HostNPScriptObject::GetPinHash(const NPVariant* args,
}
std::string pin = StringFromNPVariant(args[1]);
- std::string hash = protocol::AuthenticationMethod::ApplyHashFunction(
- protocol::AuthenticationMethod::HMAC_SHA256, host_id, pin);
- std::string hash_base64;
- bool base64_result = base::Base64Encode(hash, &hash_base64);
- if (!base64_result) {
- LOG(FATAL) << "Base64Encode failed";
- }
-
- *result = NPVariantFromString(hash_base64);
+ *result = NPVariantFromString(remoting::MakeHostPinHash(host_id, pin));
return true;
}

Powered by Google App Engine
This is Rietveld 408576698