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_V2_AUTHENTICATOR_H_ | 5 #ifndef REMOTING_PROTOCOL_V2_AUTHENTICATOR_H_ |
6 #define REMOTING_PROTOCOL_V2_AUTHENTICATOR_H_ | 6 #define REMOTING_PROTOCOL_V2_AUTHENTICATOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <queue> | 9 #include <queue> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 class V2Authenticator : public Authenticator { | 24 class V2Authenticator : public Authenticator { |
25 public: | 25 public: |
26 static bool IsEkeMessage(const buzz::XmlElement* message); | 26 static bool IsEkeMessage(const buzz::XmlElement* message); |
27 | 27 |
28 static V2Authenticator* CreateForClient( | 28 static V2Authenticator* CreateForClient( |
29 const std::string& shared_secret); | 29 const std::string& shared_secret); |
30 | 30 |
31 static V2Authenticator* CreateForHost( | 31 static V2Authenticator* CreateForHost( |
32 const std::string& local_cert, | 32 const std::string& local_cert, |
33 crypto::RSAPrivateKey* local_private_key, | 33 const crypto::RSAPrivateKey& local_private_key, |
34 const std::string& shared_secret); | 34 const std::string& shared_secret); |
35 | 35 |
36 virtual ~V2Authenticator(); | 36 virtual ~V2Authenticator(); |
37 | 37 |
38 // Authenticator interface. | 38 // Authenticator interface. |
39 virtual State state() const OVERRIDE; | 39 virtual State state() const OVERRIDE; |
40 virtual void ProcessMessage(const buzz::XmlElement* message) OVERRIDE; | 40 virtual void ProcessMessage(const buzz::XmlElement* message) OVERRIDE; |
41 virtual buzz::XmlElement* GetNextMessage() OVERRIDE; | 41 virtual buzz::XmlElement* GetNextMessage() OVERRIDE; |
42 virtual ChannelAuthenticator* CreateChannelAuthenticator() const OVERRIDE; | 42 virtual ChannelAuthenticator* CreateChannelAuthenticator() const OVERRIDE; |
43 | 43 |
(...skipping 15 matching lines...) Expand all Loading... |
59 | 59 |
60 // Used for both HOST and CLIENT authenticators. | 60 // Used for both HOST and CLIENT authenticators. |
61 crypto::P224EncryptedKeyExchange key_exchange_impl_; | 61 crypto::P224EncryptedKeyExchange key_exchange_impl_; |
62 State state_; | 62 State state_; |
63 std::queue<std::string> pending_messages_; | 63 std::queue<std::string> pending_messages_; |
64 std::string auth_key_; | 64 std::string auth_key_; |
65 | 65 |
66 DISALLOW_COPY_AND_ASSIGN(V2Authenticator); | 66 DISALLOW_COPY_AND_ASSIGN(V2Authenticator); |
67 }; | 67 }; |
68 | 68 |
69 class V2HostAuthenticatorFactory : public AuthenticatorFactory { | |
70 public: | |
71 // Doesn't take ownership of |local_private_key|. | |
72 V2HostAuthenticatorFactory(const std::string& local_cert, | |
73 const crypto::RSAPrivateKey* local_private_key, | |
74 const std::string& shared_secret); | |
75 virtual ~V2HostAuthenticatorFactory(); | |
76 | |
77 // AuthenticatorFactory interface. | |
78 virtual Authenticator* CreateAuthenticator( | |
79 const std::string& remote_jid, | |
80 const buzz::XmlElement* first_message) OVERRIDE; | |
81 | |
82 private: | |
83 std::string local_cert_; | |
84 scoped_ptr<crypto::RSAPrivateKey> local_private_key_; | |
85 std::string shared_secret_; | |
86 | |
87 DISALLOW_COPY_AND_ASSIGN(V2HostAuthenticatorFactory); | |
88 }; | |
89 | |
90 } // namespace protocol | 69 } // namespace protocol |
91 } // namespace remoting | 70 } // namespace remoting |
92 | 71 |
93 #endif // REMOTING_PROTOCOL_V2_AUTHENTICATOR_H_ | 72 #endif // REMOTING_PROTOCOL_V2_AUTHENTICATOR_H_ |
OLD | NEW |