diff options
-rw-r--r-- | remoting/host/plugin/host_script_object.cc | 2 | ||||
-rw-r--r-- | remoting/host/remoting_me2me_host.cc | 2 | ||||
-rw-r--r-- | remoting/host/simple_host_process.cc | 4 | ||||
-rw-r--r-- | remoting/protocol/it2me_host_authenticator_factory.cc | 8 | ||||
-rw-r--r-- | remoting/protocol/it2me_host_authenticator_factory.h | 4 | ||||
-rw-r--r-- | remoting/protocol/me2me_host_authenticator_factory.cc | 6 | ||||
-rw-r--r-- | remoting/protocol/me2me_host_authenticator_factory.h | 2 | ||||
-rw-r--r-- | remoting/protocol/v1_authenticator.cc | 26 | ||||
-rw-r--r-- | remoting/protocol/v1_authenticator.h | 25 | ||||
-rw-r--r-- | remoting/protocol/v1_authenticator_unittest.cc | 4 | ||||
-rw-r--r-- | remoting/protocol/v2_authenticator.cc | 28 | ||||
-rw-r--r-- | remoting/protocol/v2_authenticator.h | 23 | ||||
-rw-r--r-- | remoting/protocol/v2_authenticator_unittest.cc | 4 |
13 files changed, 27 insertions, 111 deletions
diff --git a/remoting/host/plugin/host_script_object.cc b/remoting/host/plugin/host_script_object.cc index 844af25..9388dbb 100644 --- a/remoting/host/plugin/host_script_object.cc +++ b/remoting/host/plugin/host_script_object.cc @@ -670,7 +670,7 @@ void HostNPScriptObject::OnReceivedSupportID( std::string access_code = support_id + host_secret; scoped_ptr<protocol::AuthenticatorFactory> factory( new protocol::It2MeHostAuthenticatorFactory( - host_key_pair_.GenerateCertificate(), host_key_pair_.private_key(), + host_key_pair_.GenerateCertificate(), *host_key_pair_.private_key(), access_code)); host_->SetAuthenticatorFactory(factory.Pass()); diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc index 3a3192b..8bc336f 100644 --- a/remoting/host/remoting_me2me_host.cc +++ b/remoting/host/remoting_me2me_host.cc @@ -168,7 +168,7 @@ class HostProcess { scoped_ptr<protocol::AuthenticatorFactory> factory( new protocol::Me2MeHostAuthenticatorFactory( xmpp_login_, key_pair_.GenerateCertificate(), - key_pair_.private_key(), "")); + *key_pair_.private_key(), "")); host_->SetAuthenticatorFactory(factory.Pass()); } diff --git a/remoting/host/simple_host_process.cc b/remoting/host/simple_host_process.cc index b34c1b8..59f93a9 100644 --- a/remoting/host/simple_host_process.cc +++ b/remoting/host/simple_host_process.cc @@ -160,7 +160,7 @@ class SimpleHost { scoped_ptr<protocol::AuthenticatorFactory> factory( new protocol::It2MeHostAuthenticatorFactory( - key_pair->GenerateCertificate(), key_pair->private_key(), + key_pair->GenerateCertificate(), *key_pair->private_key(), access_code)); host->SetAuthenticatorFactory(factory.Pass()); } else { @@ -243,7 +243,7 @@ class SimpleHost { scoped_ptr<protocol::AuthenticatorFactory> factory( new protocol::Me2MeHostAuthenticatorFactory( xmpp_login_, key_pair_.GenerateCertificate(), - key_pair_.private_key(), "")); + *key_pair_.private_key(), "")); host_->SetAuthenticatorFactory(factory.Pass()); } } diff --git a/remoting/protocol/it2me_host_authenticator_factory.cc b/remoting/protocol/it2me_host_authenticator_factory.cc index 65145c2..21809de 100644 --- a/remoting/protocol/it2me_host_authenticator_factory.cc +++ b/remoting/protocol/it2me_host_authenticator_factory.cc @@ -14,10 +14,10 @@ namespace protocol { It2MeHostAuthenticatorFactory::It2MeHostAuthenticatorFactory( const std::string& local_cert, - const crypto::RSAPrivateKey* local_private_key, + const crypto::RSAPrivateKey& local_private_key, const std::string& shared_secret) : local_cert_(local_cert), - local_private_key_(local_private_key->Copy()), + local_private_key_(local_private_key.Copy()), shared_secret_(shared_secret) { } @@ -32,10 +32,10 @@ Authenticator* It2MeHostAuthenticatorFactory::CreateAuthenticator( // // if (V2Authenticator::IsEkeMessage(first_message)) { // return V2Authenticator::CreateForHost( - // local_cert_, local_private_key_.get(), shared_secret_); + // local_cert_, *local_private_key_, shared_secret_); // } - return new V1HostAuthenticator(local_cert_, local_private_key_.get(), + return new V1HostAuthenticator(local_cert_, *local_private_key_, shared_secret_, remote_jid); } diff --git a/remoting/protocol/it2me_host_authenticator_factory.h b/remoting/protocol/it2me_host_authenticator_factory.h index 19266e8..a924334 100644 --- a/remoting/protocol/it2me_host_authenticator_factory.h +++ b/remoting/protocol/it2me_host_authenticator_factory.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -25,7 +25,7 @@ class It2MeHostAuthenticatorFactory : public AuthenticatorFactory { public: It2MeHostAuthenticatorFactory( const std::string& local_cert, - const crypto::RSAPrivateKey* local_private_key, + const crypto::RSAPrivateKey& local_private_key, const std::string& shared_secret); virtual ~It2MeHostAuthenticatorFactory(); diff --git a/remoting/protocol/me2me_host_authenticator_factory.cc b/remoting/protocol/me2me_host_authenticator_factory.cc index 1b3bf90..758f531 100644 --- a/remoting/protocol/me2me_host_authenticator_factory.cc +++ b/remoting/protocol/me2me_host_authenticator_factory.cc @@ -15,10 +15,10 @@ namespace protocol { Me2MeHostAuthenticatorFactory::Me2MeHostAuthenticatorFactory( const std::string& local_jid, const std::string& local_cert, - const crypto::RSAPrivateKey* local_private_key, + const crypto::RSAPrivateKey& local_private_key, const std::string& shared_secret) : local_cert_(local_cert), - local_private_key_(local_private_key->Copy()), + local_private_key_(local_private_key.Copy()), shared_secret_(shared_secret) { // Verify that |local_jid| is bare. DCHECK_EQ(local_jid.find('/'), std::string::npos); @@ -55,7 +55,7 @@ Authenticator* Me2MeHostAuthenticatorFactory::CreateAuthenticator( // TODO(sergeyu): Old clients still use V1 auth protocol. Remove // this once we are done migrating to V2. - return new V1HostAuthenticator(local_cert_, local_private_key_.get(), + return new V1HostAuthenticator(local_cert_, *local_private_key_, shared_secret_, remote_jid); } diff --git a/remoting/protocol/me2me_host_authenticator_factory.h b/remoting/protocol/me2me_host_authenticator_factory.h index 0a5114b..dfbccde 100644 --- a/remoting/protocol/me2me_host_authenticator_factory.h +++ b/remoting/protocol/me2me_host_authenticator_factory.h @@ -24,7 +24,7 @@ class Me2MeHostAuthenticatorFactory : public AuthenticatorFactory { // Doesn't take ownership of |local_private_key|. Me2MeHostAuthenticatorFactory(const std::string& local_jid, const std::string& local_cert, - const crypto::RSAPrivateKey* local_private_key, + const crypto::RSAPrivateKey& local_private_key, const std::string& shared_secret); virtual ~Me2MeHostAuthenticatorFactory(); diff --git a/remoting/protocol/v1_authenticator.cc b/remoting/protocol/v1_authenticator.cc index c39fd278..56dda8c 100644 --- a/remoting/protocol/v1_authenticator.cc +++ b/remoting/protocol/v1_authenticator.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -86,11 +86,11 @@ V1ClientAuthenticator::CreateChannelAuthenticator() const { V1HostAuthenticator::V1HostAuthenticator( const std::string& local_cert, - const crypto::RSAPrivateKey* local_private_key, + const crypto::RSAPrivateKey& local_private_key, const std::string& shared_secret, const std::string& remote_jid) : local_cert_(local_cert), - local_private_key_(local_private_key->Copy()), + local_private_key_(local_private_key.Copy()), shared_secret_(shared_secret), remote_jid_(remote_jid), state_(WAITING_MESSAGE) { @@ -144,25 +144,5 @@ V1HostAuthenticator::CreateChannelAuthenticator() const { return result; }; -V1HostAuthenticatorFactory::V1HostAuthenticatorFactory( - const std::string& local_cert, - const crypto::RSAPrivateKey* local_private_key, - const std::string& shared_secret) - : local_cert_(local_cert), - local_private_key_(local_private_key->Copy()), - shared_secret_(shared_secret) { - CHECK(local_private_key_.get()); -} - -V1HostAuthenticatorFactory::~V1HostAuthenticatorFactory() { -} - -Authenticator* V1HostAuthenticatorFactory::CreateAuthenticator( - const std::string& remote_jid, - const buzz::XmlElement* first_message) { - return new V1HostAuthenticator(local_cert_, local_private_key_.get(), - shared_secret_, remote_jid); -} - } // namespace remoting } // namespace protocol diff --git a/remoting/protocol/v1_authenticator.h b/remoting/protocol/v1_authenticator.h index 6cedd0b..26d44bf 100644 --- a/remoting/protocol/v1_authenticator.h +++ b/remoting/protocol/v1_authenticator.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -42,7 +42,7 @@ class V1HostAuthenticator : public Authenticator { public: // Doesn't take ownership of |local_private_key|. V1HostAuthenticator(const std::string& local_cert, - const crypto::RSAPrivateKey* local_private_key, + const crypto::RSAPrivateKey& local_private_key, const std::string& shared_secret, const std::string& remote_jid); virtual ~V1HostAuthenticator(); @@ -63,27 +63,6 @@ class V1HostAuthenticator : public Authenticator { DISALLOW_COPY_AND_ASSIGN(V1HostAuthenticator); }; -class V1HostAuthenticatorFactory : public AuthenticatorFactory { - public: - // Doesn't take ownership of |local_private_key|. - V1HostAuthenticatorFactory(const std::string& local_cert, - const crypto::RSAPrivateKey* local_private_key, - const std::string& shared_secret); - virtual ~V1HostAuthenticatorFactory(); - - // AuthenticatorFactory interface. - virtual Authenticator* CreateAuthenticator( - const std::string& remote_jid, - const buzz::XmlElement* first_message) OVERRIDE; - - private: - std::string local_cert_; - scoped_ptr<crypto::RSAPrivateKey> local_private_key_; - std::string shared_secret_; - - DISALLOW_COPY_AND_ASSIGN(V1HostAuthenticatorFactory); -}; - } // namespace protocol } // namespace remoting diff --git a/remoting/protocol/v1_authenticator_unittest.cc b/remoting/protocol/v1_authenticator_unittest.cc index 5ffa317..772661d 100644 --- a/remoting/protocol/v1_authenticator_unittest.cc +++ b/remoting/protocol/v1_authenticator_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -77,7 +77,7 @@ class V1AuthenticatorTest : public testing::Test { void InitAuthenticators(const std::string& client_secret, const std::string& host_secret) { host_.reset(new V1HostAuthenticator( - host_cert_, private_key_.get(), host_secret, kClientJid)); + host_cert_, *private_key_, host_secret, kClientJid)); client_.reset(new V1ClientAuthenticator(kClientJid, client_secret)); } diff --git a/remoting/protocol/v2_authenticator.cc b/remoting/protocol/v2_authenticator.cc index 0e78098..edfc1cef 100644 --- a/remoting/protocol/v2_authenticator.cc +++ b/remoting/protocol/v2_authenticator.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -44,12 +44,12 @@ V2Authenticator* V2Authenticator::CreateForClient( // static V2Authenticator* V2Authenticator::CreateForHost( const std::string& local_cert, - crypto::RSAPrivateKey* local_private_key, + const crypto::RSAPrivateKey& local_private_key, const std::string& shared_secret) { V2Authenticator* result = new V2Authenticator( P224EncryptedKeyExchange::kPeerTypeServer, shared_secret); result->local_cert_ = local_cert; - result->local_private_key_.reset(local_private_key->Copy()); + result->local_private_key_.reset(local_private_key.Copy()); result->state_ = WAITING_MESSAGE; return result; } @@ -183,27 +183,5 @@ bool V2Authenticator::is_host_side() const { return local_private_key_.get() != NULL; } -V2HostAuthenticatorFactory::V2HostAuthenticatorFactory( - const std::string& local_cert, - const crypto::RSAPrivateKey* local_private_key, - const std::string& shared_secret) - : local_cert_(local_cert), - local_private_key_(local_private_key->Copy()), - shared_secret_(shared_secret) { - CHECK(local_private_key_.get()); -} - -V2HostAuthenticatorFactory::~V2HostAuthenticatorFactory() { -} - -Authenticator* V2HostAuthenticatorFactory::CreateAuthenticator( - const std::string& remote_jid, - const buzz::XmlElement* first_message) { - if (!V2Authenticator::IsEkeMessage(first_message)) - return NULL; - return V2Authenticator::CreateForHost( - local_cert_, local_private_key_.get(), shared_secret_); -} - } // namespace protocol } // namespace remoting diff --git a/remoting/protocol/v2_authenticator.h b/remoting/protocol/v2_authenticator.h index 3dc1cde..9828233 100644 --- a/remoting/protocol/v2_authenticator.h +++ b/remoting/protocol/v2_authenticator.h @@ -30,7 +30,7 @@ class V2Authenticator : public Authenticator { static V2Authenticator* CreateForHost( const std::string& local_cert, - crypto::RSAPrivateKey* local_private_key, + const crypto::RSAPrivateKey& local_private_key, const std::string& shared_secret); virtual ~V2Authenticator(); @@ -66,27 +66,6 @@ class V2Authenticator : public Authenticator { DISALLOW_COPY_AND_ASSIGN(V2Authenticator); }; -class V2HostAuthenticatorFactory : public AuthenticatorFactory { - public: - // Doesn't take ownership of |local_private_key|. - V2HostAuthenticatorFactory(const std::string& local_cert, - const crypto::RSAPrivateKey* local_private_key, - const std::string& shared_secret); - virtual ~V2HostAuthenticatorFactory(); - - // AuthenticatorFactory interface. - virtual Authenticator* CreateAuthenticator( - const std::string& remote_jid, - const buzz::XmlElement* first_message) OVERRIDE; - - private: - std::string local_cert_; - scoped_ptr<crypto::RSAPrivateKey> local_private_key_; - std::string shared_secret_; - - DISALLOW_COPY_AND_ASSIGN(V2HostAuthenticatorFactory); -}; - } // namespace protocol } // namespace remoting diff --git a/remoting/protocol/v2_authenticator_unittest.cc b/remoting/protocol/v2_authenticator_unittest.cc index d1530de..812ee1d 100644 --- a/remoting/protocol/v2_authenticator_unittest.cc +++ b/remoting/protocol/v2_authenticator_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -76,7 +76,7 @@ class V2AuthenticatorTest : public testing::Test { void InitAuthenticators(const std::string& client_secret, const std::string& host_secret) { host_.reset(V2Authenticator::CreateForHost( - host_cert_, private_key_.get(), host_secret)); + host_cert_, *private_key_, host_secret)); client_.reset(V2Authenticator::CreateForClient(client_secret)); } |