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 #ifndef REMOTING_PROTOCOL_ME2ME_HOST_AUTHENTICATOR_FACTORY_H_ | 5 #ifndef REMOTING_PROTOCOL_ME2ME_HOST_AUTHENTICATOR_FACTORY_H_ |
6 #define REMOTING_PROTOCOL_ME2ME_HOST_AUTHENTICATOR_FACTORY_H_ | 6 #define REMOTING_PROTOCOL_ME2ME_HOST_AUTHENTICATOR_FACTORY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "remoting/protocol/authentication_method.h" | |
13 #include "remoting/protocol/authenticator.h" | 14 #include "remoting/protocol/authenticator.h" |
14 | 15 |
15 namespace crypto { | 16 namespace crypto { |
16 class RSAPrivateKey; | 17 class RSAPrivateKey; |
17 } // namespace crypto | 18 } // namespace crypto |
18 | 19 |
19 namespace remoting { | 20 namespace remoting { |
20 namespace protocol { | 21 namespace protocol { |
21 | 22 |
23 // SharedSecretHash stores hash of a host secret paired with the type | |
24 // of the hashing function. | |
25 struct SharedSecretHash { | |
Wez
2012/01/23 23:53:49
nit: SharedSecretHash -> HostSharedSecret?
Sergey Ulanov
2012/01/24 06:32:22
IMHO SharedSecretHash better reflects the purpose
| |
26 AuthenticationMethod::HashFunction hash_function; | |
27 std::string value; | |
28 | |
29 // Parse string representation of a shared secret hash. The |as_string| | |
30 // must be in form "<hash_function>;<hash_value_base64>". | |
Wez
2012/01/23 23:53:49
nit: ":" rather than ";" - ";" tends to get used w
Sergey Ulanov
2012/01/24 06:32:22
Done.
| |
31 bool Parse(const std::string& as_string); | |
32 }; | |
33 | |
22 class Me2MeHostAuthenticatorFactory : public AuthenticatorFactory { | 34 class Me2MeHostAuthenticatorFactory : public AuthenticatorFactory { |
23 public: | 35 public: |
24 // Doesn't take ownership of |local_private_key|. | 36 // Doesn't take ownership of |local_private_key|. |
25 Me2MeHostAuthenticatorFactory(const std::string& local_jid, | 37 Me2MeHostAuthenticatorFactory( |
26 const std::string& local_cert, | 38 const std::string& local_jid, |
27 const crypto::RSAPrivateKey& local_private_key, | 39 const std::string& local_cert, |
28 const std::string& shared_secret); | 40 const crypto::RSAPrivateKey& local_private_key, |
41 const SharedSecretHash& shared_secret_hash); | |
29 virtual ~Me2MeHostAuthenticatorFactory(); | 42 virtual ~Me2MeHostAuthenticatorFactory(); |
30 | 43 |
31 // AuthenticatorFactory interface. | 44 // AuthenticatorFactory interface. |
32 virtual scoped_ptr<Authenticator> CreateAuthenticator( | 45 virtual scoped_ptr<Authenticator> CreateAuthenticator( |
33 const std::string& remote_jid, | 46 const std::string& remote_jid, |
34 const buzz::XmlElement* first_message) OVERRIDE; | 47 const buzz::XmlElement* first_message) OVERRIDE; |
35 | 48 |
36 private: | 49 private: |
37 std::string local_jid_prefix_; | 50 std::string local_jid_prefix_; |
38 std::string local_cert_; | 51 std::string local_cert_; |
39 scoped_ptr<crypto::RSAPrivateKey> local_private_key_; | 52 scoped_ptr<crypto::RSAPrivateKey> local_private_key_; |
40 std::string shared_secret_; | 53 SharedSecretHash shared_secret_hash_; |
41 | 54 |
42 DISALLOW_COPY_AND_ASSIGN(Me2MeHostAuthenticatorFactory); | 55 DISALLOW_COPY_AND_ASSIGN(Me2MeHostAuthenticatorFactory); |
43 }; | 56 }; |
44 | 57 |
45 } // namespace protocol | 58 } // namespace protocol |
46 } // namespace remoting | 59 } // namespace remoting |
47 | 60 |
48 #endif // REMOTING_PROTOCOL_ME2ME_HOST_AUTHENTICATOR_FACTORY_H_ | 61 #endif // REMOTING_PROTOCOL_ME2ME_HOST_AUTHENTICATOR_FACTORY_H_ |
OLD | NEW |