summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--remoting/protocol/authentication_method.cc22
-rw-r--r--remoting/protocol/authentication_method.h11
-rw-r--r--remoting/protocol/me2me_host_authenticator_factory.cc21
-rw-r--r--remoting/protocol/me2me_host_authenticator_factory.h11
4 files changed, 33 insertions, 32 deletions
diff --git a/remoting/protocol/authentication_method.cc b/remoting/protocol/authentication_method.cc
index fc9289f..ab60f39 100644
--- a/remoting/protocol/authentication_method.cc
+++ b/remoting/protocol/authentication_method.cc
@@ -4,6 +4,7 @@
#include "remoting/protocol/authentication_method.h"
+#include "base/base64.h"
#include "base/logging.h"
#include "crypto/hmac.h"
#include "remoting/protocol/auth_util.h"
@@ -100,5 +101,26 @@ bool AuthenticationMethod::operator ==(
return hash_function_ == other.hash_function_;
}
+bool SharedSecretHash::Parse(const std::string& as_string) {
+ size_t separator = as_string.find(':');
+ if (separator == std::string::npos)
+ return false;
+
+ std::string function_name = as_string.substr(0, separator);
+ if (function_name == "plain") {
+ hash_function = AuthenticationMethod::NONE;
+ } else if (function_name == "hmac") {
+ hash_function = AuthenticationMethod::HMAC_SHA256;
+ } else {
+ return false;
+ }
+
+ if (!base::Base64Decode(as_string.substr(separator + 1), &value)) {
+ return false;
+ }
+
+ return true;
+}
+
} // namespace protocol
} // namespace remoting
diff --git a/remoting/protocol/authentication_method.h b/remoting/protocol/authentication_method.h
index 6702187..a4f003e 100644
--- a/remoting/protocol/authentication_method.h
+++ b/remoting/protocol/authentication_method.h
@@ -69,6 +69,17 @@ class AuthenticationMethod {
HashFunction hash_function_;
};
+// SharedSecretHash stores hash of a host secret paired with the type
+// of the hashing function.
+struct SharedSecretHash {
+ AuthenticationMethod::HashFunction hash_function;
+ std::string value;
+
+ // Parse string representation of a shared secret hash. The |as_string|
+ // must be in form "<hash_function>:<hash_value_base64>".
+ bool Parse(const std::string& as_string);
+};
+
} // namespace protocol
} // namespace remoting
diff --git a/remoting/protocol/me2me_host_authenticator_factory.cc b/remoting/protocol/me2me_host_authenticator_factory.cc
index 8762a48..776c2d1 100644
--- a/remoting/protocol/me2me_host_authenticator_factory.cc
+++ b/remoting/protocol/me2me_host_authenticator_factory.cc
@@ -57,27 +57,6 @@ class RejectingAuthenticator : public Authenticator {
} // namespace
-bool SharedSecretHash::Parse(const std::string& as_string) {
- size_t separator = as_string.find(':');
- if (separator == std::string::npos)
- return false;
-
- std::string function_name = as_string.substr(0, separator);
- if (function_name == "plain") {
- hash_function = AuthenticationMethod::NONE;
- } else if (function_name == "hmac") {
- hash_function = AuthenticationMethod::HMAC_SHA256;
- } else {
- return false;
- }
-
- if (!base::Base64Decode(as_string.substr(separator + 1), &value)) {
- return false;
- }
-
- return true;
-}
-
Me2MeHostAuthenticatorFactory::Me2MeHostAuthenticatorFactory(
const std::string& local_jid,
const std::string& local_cert,
diff --git a/remoting/protocol/me2me_host_authenticator_factory.h b/remoting/protocol/me2me_host_authenticator_factory.h
index a2cf3e5..b0f9b4e 100644
--- a/remoting/protocol/me2me_host_authenticator_factory.h
+++ b/remoting/protocol/me2me_host_authenticator_factory.h
@@ -20,17 +20,6 @@ class RSAPrivateKey;
namespace remoting {
namespace protocol {
-// SharedSecretHash stores hash of a host secret paired with the type
-// of the hashing function.
-struct SharedSecretHash {
- AuthenticationMethod::HashFunction hash_function;
- std::string value;
-
- // Parse string representation of a shared secret hash. The |as_string|
- // must be in form "<hash_function>:<hash_value_base64>".
- bool Parse(const std::string& as_string);
-};
-
class Me2MeHostAuthenticatorFactory : public AuthenticatorFactory {
public:
// Doesn't take ownership of |local_private_key|.