Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Side by Side Diff: remoting/protocol/v2_authenticator.h

Issue 12316083: Move HostKeyPair into protocol::KeyPair. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Reviewer comments Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "crypto/p224_spake.h" 14 #include "crypto/p224_spake.h"
15 #include "remoting/protocol/authenticator.h" 15 #include "remoting/protocol/authenticator.h"
16 16
17 namespace crypto { 17 namespace remoting {
18 class RSAPrivateKey;
19 } // namespace crypto
20 18
21 namespace remoting { 19 class RsaKeyPair;
20
22 namespace protocol { 21 namespace protocol {
23 22
24 class V2Authenticator : public Authenticator { 23 class V2Authenticator : public Authenticator {
25 public: 24 public:
26 static bool IsEkeMessage(const buzz::XmlElement* message); 25 static bool IsEkeMessage(const buzz::XmlElement* message);
27 26
28 static scoped_ptr<Authenticator> CreateForClient( 27 static scoped_ptr<Authenticator> CreateForClient(
29 const std::string& shared_secret, 28 const std::string& shared_secret,
30 State initial_state); 29 State initial_state);
31 30
32 static scoped_ptr<Authenticator> CreateForHost( 31 static scoped_ptr<Authenticator> CreateForHost(
33 const std::string& local_cert, 32 const std::string& local_cert,
34 const crypto::RSAPrivateKey& local_private_key, 33 scoped_refptr<RsaKeyPair> key_pair,
35 const std::string& shared_secret, 34 const std::string& shared_secret,
36 State initial_state); 35 State initial_state);
37 36
38 virtual ~V2Authenticator(); 37 virtual ~V2Authenticator();
39 38
40 // Authenticator interface. 39 // Authenticator interface.
41 virtual State state() const OVERRIDE; 40 virtual State state() const OVERRIDE;
42 virtual RejectionReason rejection_reason() const OVERRIDE; 41 virtual RejectionReason rejection_reason() const OVERRIDE;
43 virtual void ProcessMessage(const buzz::XmlElement* message, 42 virtual void ProcessMessage(const buzz::XmlElement* message,
44 const base::Closure& resume_callback) OVERRIDE; 43 const base::Closure& resume_callback) OVERRIDE;
45 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE; 44 virtual scoped_ptr<buzz::XmlElement> GetNextMessage() OVERRIDE;
46 virtual scoped_ptr<ChannelAuthenticator> 45 virtual scoped_ptr<ChannelAuthenticator>
47 CreateChannelAuthenticator() const OVERRIDE; 46 CreateChannelAuthenticator() const OVERRIDE;
48 47
49 private: 48 private:
50 FRIEND_TEST_ALL_PREFIXES(V2AuthenticatorTest, InvalidSecret); 49 FRIEND_TEST_ALL_PREFIXES(V2AuthenticatorTest, InvalidSecret);
51 50
52 V2Authenticator(crypto::P224EncryptedKeyExchange::PeerType type, 51 V2Authenticator(crypto::P224EncryptedKeyExchange::PeerType type,
53 const std::string& shared_secret, 52 const std::string& shared_secret,
54 State initial_state); 53 State initial_state);
55 54
56 virtual void ProcessMessageInternal(const buzz::XmlElement* message); 55 virtual void ProcessMessageInternal(const buzz::XmlElement* message);
57 56
58 bool is_host_side() const; 57 bool is_host_side() const;
59 58
60 // Used only for host authenticators. 59 // Used only for host authenticators.
61 std::string local_cert_; 60 std::string local_cert_;
62 scoped_ptr<crypto::RSAPrivateKey> local_private_key_; 61 scoped_refptr<RsaKeyPair> local_key_pair_;
63 bool certificate_sent_; 62 bool certificate_sent_;
64 63
65 // Used only for client authenticators. 64 // Used only for client authenticators.
66 std::string remote_cert_; 65 std::string remote_cert_;
67 66
68 // Used for both host and client authenticators. 67 // Used for both host and client authenticators.
69 crypto::P224EncryptedKeyExchange key_exchange_impl_; 68 crypto::P224EncryptedKeyExchange key_exchange_impl_;
70 State state_; 69 State state_;
71 RejectionReason rejection_reason_; 70 RejectionReason rejection_reason_;
72 std::queue<std::string> pending_messages_; 71 std::queue<std::string> pending_messages_;
73 std::string auth_key_; 72 std::string auth_key_;
74 73
75 DISALLOW_COPY_AND_ASSIGN(V2Authenticator); 74 DISALLOW_COPY_AND_ASSIGN(V2Authenticator);
76 }; 75 };
77 76
78 } // namespace protocol 77 } // namespace protocol
79 } // namespace remoting 78 } // namespace remoting
80 79
81 #endif // REMOTING_PROTOCOL_V2_AUTHENTICATOR_H_ 80 #endif // REMOTING_PROTOCOL_V2_AUTHENTICATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698