summaryrefslogtreecommitdiffstats
path: root/remoting/host/verify_config_window_win.cc
diff options
context:
space:
mode:
authorsimonmorris@chromium.org <simonmorris@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-01 18:17:42 +0000
committersimonmorris@chromium.org <simonmorris@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-01 18:17:42 +0000
commit6cdc63f2d9b21a8ce76858a4bf5bca81995354c5 (patch)
tree4781382a099082ae43e901b91a90fe1660da318b /remoting/host/verify_config_window_win.cc
parenteca0da37ac534aef8d60d7997e75e47b6b01ca7a (diff)
downloadchromium_src-6cdc63f2d9b21a8ce76858a4bf5bca81995354c5.zip
chromium_src-6cdc63f2d9b21a8ce76858a4bf5bca81995354c5.tar.gz
chromium_src-6cdc63f2d9b21a8ce76858a4bf5bca81995354c5.tar.bz2
[Chromoting] Factor out common code for pin hashing.
Review URL: http://codereview.chromium.org/10243011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@134725 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/verify_config_window_win.cc')
-rw-r--r--remoting/host/verify_config_window_win.cc16
1 files changed, 2 insertions, 14 deletions
diff --git a/remoting/host/verify_config_window_win.cc b/remoting/host/verify_config_window_win.cc
index d2e695f..39c6a4a2 100644
--- a/remoting/host/verify_config_window_win.cc
+++ b/remoting/host/verify_config_window_win.cc
@@ -12,6 +12,7 @@
#include "base/logging.h"
#include "base/utf_string_conversions.h"
#include "remoting/host/elevated_controller_resource.h"
+#include "remoting/host/pin_hash.h"
#include "remoting/protocol/authentication_method.h"
namespace remoting {
@@ -117,21 +118,8 @@ bool VerifyConfigWindowWin::VerifyHostSecretHash() {
HWND hwndPin = GetDlgItem(hwnd_, IDC_PIN);
CHECK(hwndPin);
GetWindowText(hwndPin, pinWSTR.get(), kMaxPinLength);
-
- // TODO(simonmorris): This code was copied from host_script_object.cc.
- // Refactor to use PinIsValid(), from CL 10008092.
std::string pin(UTF16ToUTF8(pinWSTR.get()));
- 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";
- return false;
- }
- hash_base64 = "hmac:" + hash_base64;
-
- return (hash_base64 == host_secret_hash_);
+ return VerifyHostPinHash(host_secret_hash_, host_id_, pin);
}
} // namespace remoting