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

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

Issue 12316083: Move HostKeyPair into protocol::KeyPair. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 7 years, 9 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 | « remoting/host/plugin/host_script_object.h ('k') | remoting/host/register_support_host_request.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1346bceacfb79056ed63f99fc29716f6fa11805b..63b85139636a81fa296154851dd709c8367fd657 100644
--- a/remoting/host/plugin/host_script_object.cc
+++ b/remoting/host/plugin/host_script_object.cc
@@ -18,12 +18,12 @@
#include "net/base/net_util.h"
#include "remoting/base/auth_token_util.h"
#include "remoting/base/auto_thread.h"
+#include "remoting/base/rsa_key_pair.h"
#include "remoting/host/basic_desktop_environment.h"
#include "remoting/host/chromoting_host.h"
#include "remoting/host/chromoting_host_context.h"
#include "remoting/host/host_config.h"
#include "remoting/host/host_event_logger.h"
-#include "remoting/host/host_key_pair.h"
#include "remoting/host/host_secret.h"
#include "remoting/host/host_status_observer.h"
#include "remoting/host/it2me_host_user_interface.h"
@@ -162,7 +162,7 @@ class HostNPScriptObject::It2MeImpl
State state_;
- HostKeyPair host_key_pair_;
+ scoped_refptr<RsaKeyPair> host_key_pair_;
scoped_ptr<SignalStrategy> signal_strategy_;
scoped_ptr<RegisterSupportHostRequest> register_request_;
scoped_ptr<LogToServer> log_to_server_;
@@ -344,7 +344,7 @@ void HostNPScriptObject::It2MeImpl::FinishConnect(
// Generate a key pair for the Host to use.
// TODO(wez): Move this to the worker thread.
- host_key_pair_.Generate();
+ host_key_pair_ = RsaKeyPair::Generate();
// Create XMPP connection.
scoped_ptr<SignalStrategy> signal_strategy(
@@ -355,7 +355,7 @@ void HostNPScriptObject::It2MeImpl::FinishConnect(
// Request registration of the host for support.
scoped_ptr<RegisterSupportHostRequest> register_request(
new RegisterSupportHostRequest(
- signal_strategy.get(), &host_key_pair_, directory_bot_jid_,
+ signal_strategy.get(), host_key_pair_, directory_bot_jid_,
base::Bind(&It2MeImpl::OnReceivedSupportID,
base::Unretained(this))));
@@ -642,7 +642,7 @@ void HostNPScriptObject::It2MeImpl::OnReceivedSupportID(
std::string host_secret = GenerateSupportHostSecret();
std::string access_code = support_id + host_secret;
- std::string local_certificate = host_key_pair_.GenerateCertificate();
+ std::string local_certificate = host_key_pair_->GenerateCertificate();
if (local_certificate.empty()) {
LOG(ERROR) << "Failed to generate host certificate.";
SetState(kError);
@@ -652,7 +652,7 @@ void HostNPScriptObject::It2MeImpl::OnReceivedSupportID(
scoped_ptr<protocol::AuthenticatorFactory> factory(
new protocol::It2MeHostAuthenticatorFactory(
- local_certificate, *host_key_pair_.private_key(), access_code));
+ local_certificate, host_key_pair_, access_code));
host_->SetAuthenticatorFactory(factory.Pass());
// Pass the Access Code to the script object before changing state.
@@ -1448,10 +1448,9 @@ bool HostNPScriptObject::LocalizeStringWithSubstitution(
}
void HostNPScriptObject::DoGenerateKeyPair(const ScopedRefNPObject& callback) {
- HostKeyPair key_pair;
- key_pair.Generate();
- InvokeGenerateKeyPairCallback(callback, key_pair.GetAsString(),
- key_pair.GetPublicKey());
+ scoped_refptr<RsaKeyPair> key_pair = RsaKeyPair::Generate();
+ InvokeGenerateKeyPairCallback(callback, key_pair->ToString(),
+ key_pair->GetPublicKey());
}
void HostNPScriptObject::InvokeGenerateKeyPairCallback(
« no previous file with comments | « remoting/host/plugin/host_script_object.h ('k') | remoting/host/register_support_host_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698