| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/protocol/me2me_host_authenticator_factory.h" | 5 #include "remoting/protocol/me2me_host_authenticator_factory.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "crypto/rsa_private_key.h" | 8 #include "crypto/rsa_private_key.h" |
| 9 #include "remoting/protocol/v1_authenticator.h" | 9 #include "remoting/protocol/v1_authenticator.h" |
| 10 #include "remoting/protocol/v2_authenticator.h" | 10 #include "remoting/protocol/v2_authenticator.h" |
| 11 | 11 |
| 12 namespace remoting { | 12 namespace remoting { |
| 13 namespace protocol { | 13 namespace protocol { |
| 14 | 14 |
| 15 Me2MeHostAuthenticatorFactory::Me2MeHostAuthenticatorFactory( | 15 Me2MeHostAuthenticatorFactory::Me2MeHostAuthenticatorFactory( |
| 16 const std::string& local_jid, | 16 const std::string& local_jid, |
| 17 const std::string& local_cert, | 17 const std::string& local_cert, |
| 18 const crypto::RSAPrivateKey* local_private_key, | 18 const crypto::RSAPrivateKey& local_private_key, |
| 19 const std::string& shared_secret) | 19 const std::string& shared_secret) |
| 20 : local_cert_(local_cert), | 20 : local_cert_(local_cert), |
| 21 local_private_key_(local_private_key->Copy()), | 21 local_private_key_(local_private_key.Copy()), |
| 22 shared_secret_(shared_secret) { | 22 shared_secret_(shared_secret) { |
| 23 // Verify that |local_jid| is bare. | 23 // Verify that |local_jid| is bare. |
| 24 DCHECK_EQ(local_jid.find('/'), std::string::npos); | 24 DCHECK_EQ(local_jid.find('/'), std::string::npos); |
| 25 local_jid_prefix_ = local_jid + '/'; | 25 local_jid_prefix_ = local_jid + '/'; |
| 26 } | 26 } |
| 27 | 27 |
| 28 Me2MeHostAuthenticatorFactory::~Me2MeHostAuthenticatorFactory() { | 28 Me2MeHostAuthenticatorFactory::~Me2MeHostAuthenticatorFactory() { |
| 29 } | 29 } |
| 30 | 30 |
| 31 Authenticator* Me2MeHostAuthenticatorFactory::CreateAuthenticator( | 31 Authenticator* Me2MeHostAuthenticatorFactory::CreateAuthenticator( |
| (...skipping 16 matching lines...) Expand all Loading... |
| 48 // TODO(sergeyu): V2 authenticator is not finished yet. Enable it | 48 // TODO(sergeyu): V2 authenticator is not finished yet. Enable it |
| 49 // here when it is finished. crbug.com/105214 | 49 // here when it is finished. crbug.com/105214 |
| 50 // | 50 // |
| 51 // if (V2Authenticator::IsEkeMessage(first_message)) { | 51 // if (V2Authenticator::IsEkeMessage(first_message)) { |
| 52 // return V2Authenticator::CreateForHost( | 52 // return V2Authenticator::CreateForHost( |
| 53 // local_cert_, local_private_key_.get(), shared_secret_); | 53 // local_cert_, local_private_key_.get(), shared_secret_); |
| 54 // } | 54 // } |
| 55 | 55 |
| 56 // TODO(sergeyu): Old clients still use V1 auth protocol. Remove | 56 // TODO(sergeyu): Old clients still use V1 auth protocol. Remove |
| 57 // this once we are done migrating to V2. | 57 // this once we are done migrating to V2. |
| 58 return new V1HostAuthenticator(local_cert_, local_private_key_.get(), | 58 return new V1HostAuthenticator(local_cert_, *local_private_key_, |
| 59 shared_secret_, remote_jid); | 59 shared_secret_, remote_jid); |
| 60 } | 60 } |
| 61 | 61 |
| 62 } // namespace protocol | 62 } // namespace protocol |
| 63 } // namespace remoting | 63 } // namespace remoting |
| OLD | NEW |