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 <memory> |
8 #include <queue> | 9 #include <queue> |
9 #include <string> | 10 #include <string> |
10 | 11 |
11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
12 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
13 #include "base/macros.h" | 14 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | |
16 #include "crypto/p224_spake.h" | 16 #include "crypto/p224_spake.h" |
17 #include "remoting/protocol/authenticator.h" | 17 #include "remoting/protocol/authenticator.h" |
18 | 18 |
19 namespace remoting { | 19 namespace remoting { |
20 | 20 |
21 class RsaKeyPair; | 21 class RsaKeyPair; |
22 | 22 |
23 namespace protocol { | 23 namespace protocol { |
24 | 24 |
25 class V2Authenticator : public Authenticator { | 25 class V2Authenticator : public Authenticator { |
26 public: | 26 public: |
27 static bool IsEkeMessage(const buzz::XmlElement* message); | 27 static bool IsEkeMessage(const buzz::XmlElement* message); |
28 | 28 |
29 static scoped_ptr<Authenticator> CreateForClient( | 29 static std::unique_ptr<Authenticator> CreateForClient( |
30 const std::string& shared_secret, | 30 const std::string& shared_secret, |
31 State initial_state); | 31 State initial_state); |
32 | 32 |
33 static scoped_ptr<Authenticator> CreateForHost( | 33 static std::unique_ptr<Authenticator> CreateForHost( |
34 const std::string& local_cert, | 34 const std::string& local_cert, |
35 scoped_refptr<RsaKeyPair> key_pair, | 35 scoped_refptr<RsaKeyPair> key_pair, |
36 const std::string& shared_secret, | 36 const std::string& shared_secret, |
37 State initial_state); | 37 State initial_state); |
38 | 38 |
39 ~V2Authenticator() override; | 39 ~V2Authenticator() override; |
40 | 40 |
41 // Authenticator interface. | 41 // Authenticator interface. |
42 State state() const override; | 42 State state() const override; |
43 bool started() const override; | 43 bool started() const override; |
44 RejectionReason rejection_reason() const override; | 44 RejectionReason rejection_reason() const override; |
45 void ProcessMessage(const buzz::XmlElement* message, | 45 void ProcessMessage(const buzz::XmlElement* message, |
46 const base::Closure& resume_callback) override; | 46 const base::Closure& resume_callback) override; |
47 scoped_ptr<buzz::XmlElement> GetNextMessage() override; | 47 std::unique_ptr<buzz::XmlElement> GetNextMessage() override; |
48 const std::string& GetAuthKey() const override; | 48 const std::string& GetAuthKey() const override; |
49 scoped_ptr<ChannelAuthenticator> CreateChannelAuthenticator() const override; | 49 std::unique_ptr<ChannelAuthenticator> CreateChannelAuthenticator() |
| 50 const override; |
50 | 51 |
51 private: | 52 private: |
52 FRIEND_TEST_ALL_PREFIXES(V2AuthenticatorTest, InvalidSecret); | 53 FRIEND_TEST_ALL_PREFIXES(V2AuthenticatorTest, InvalidSecret); |
53 | 54 |
54 V2Authenticator(crypto::P224EncryptedKeyExchange::PeerType type, | 55 V2Authenticator(crypto::P224EncryptedKeyExchange::PeerType type, |
55 const std::string& shared_secret, | 56 const std::string& shared_secret, |
56 State initial_state); | 57 State initial_state); |
57 | 58 |
58 virtual void ProcessMessageInternal(const buzz::XmlElement* message); | 59 virtual void ProcessMessageInternal(const buzz::XmlElement* message); |
59 | 60 |
(...skipping 15 matching lines...) Expand all Loading... |
75 std::queue<std::string> pending_messages_; | 76 std::queue<std::string> pending_messages_; |
76 std::string auth_key_; | 77 std::string auth_key_; |
77 | 78 |
78 DISALLOW_COPY_AND_ASSIGN(V2Authenticator); | 79 DISALLOW_COPY_AND_ASSIGN(V2Authenticator); |
79 }; | 80 }; |
80 | 81 |
81 } // namespace protocol | 82 } // namespace protocol |
82 } // namespace remoting | 83 } // namespace remoting |
83 | 84 |
84 #endif // REMOTING_PROTOCOL_V2_AUTHENTICATOR_H_ | 85 #endif // REMOTING_PROTOCOL_V2_AUTHENTICATOR_H_ |
OLD | NEW |