Index: remoting/host/remoting_me2me_host.cc |
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc |
index d676b8f93d1707624ea4e19c1002e5cbc6c76023..e03b4131de6c20ccdbfb06d11c8ebd41bf60f144 100644 |
--- a/remoting/host/remoting_me2me_host.cc |
+++ b/remoting/host/remoting_me2me_host.cc |
@@ -291,7 +291,7 @@ class HostProcess |
std::string host_id_; |
protocol::SharedSecretHash host_secret_hash_; |
- HostKeyPair key_pair_; |
+ scoped_refptr<RsaKeyPair> key_pair_; |
std::string oauth_refresh_token_; |
std::string serialized_config_; |
std::string xmpp_login_; |
@@ -514,7 +514,7 @@ void HostProcess::CreateAuthenticatorFactory() { |
if (state_ != HOST_STARTED) |
return; |
- std::string local_certificate = key_pair_.GenerateCertificate(); |
+ std::string local_certificate = key_pair_->GenerateCertificate(); |
if (local_certificate.empty()) { |
LOG(ERROR) << "Failed to generate host certificate."; |
ShutdownHost(kInitializationFailed); |
@@ -523,7 +523,7 @@ void HostProcess::CreateAuthenticatorFactory() { |
scoped_ptr<protocol::AuthenticatorFactory> factory( |
new protocol::Me2MeHostAuthenticatorFactory( |
- local_certificate, *key_pair_.private_key(), host_secret_hash_)); |
+ local_certificate, key_pair_, host_secret_hash_)); |
#if defined(OS_POSIX) |
// On Linux and Mac, perform a PAM authorization step after authentication. |
factory.reset(new PamAuthorizationFactory(factory.Pass())); |
@@ -685,7 +685,11 @@ bool HostProcess::ApplyConfig(scoped_ptr<JsonHostConfig> config) { |
return false; |
} |
- if (!key_pair_.Load(*config)) { |
+ key_pair_ = new RsaKeyPair(); |
+ std::string key_base64; |
+ if (!config->GetString(kPrivateKeyConfigPath, &key_base64) || |
+ !key_pair_->LoadFromString(key_base64)) { |
+ LOG(ERROR) << "Private key couldn't be read from the config file."; |
return false; |
} |
@@ -930,7 +934,8 @@ void HostProcess::StartHost() { |
#endif |
heartbeat_sender_.reset(new HeartbeatSender( |
- this, host_id_, signal_strategy_.get(), &key_pair_, directory_bot_jid_)); |
+ this, host_id_, signal_strategy_.get(), key_pair_, |
+ directory_bot_jid_)); |
host_change_notification_listener_.reset(new HostChangeNotificationListener( |
this, host_id_, signal_strategy_.get(), directory_bot_jid_)); |