OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef REMOTING_PROTOCOL_SIMPLE_HOST_CHANNEL_AUTHENTICATOR_H_ | |
6 #define REMOTING_PROTOCOL_SIMPLE_HOST_CHANNEL_AUTHENTICATOR_H_ | |
7 | |
8 #include "remoting/protocol/channel_authenticator.h" | |
9 | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "net/base/completion_callback.h" | |
12 | |
13 namespace crypto { | |
14 class RSAPrivateKey; | |
15 } // namespace crypto | |
16 | |
17 namespace net { | |
18 class GrowableIOBuffer; | |
19 class SSLServerSocket; | |
20 class SSLSocket; | |
21 } // namespace net | |
22 | |
23 namespace remoting { | |
24 namespace protocol { | |
25 | |
26 class SimpleHostChannelAuthenticator : public ChannelAuthenticator { | |
Wez
2011/11/22 22:29:48
See previous comment about the naming of this.
| |
27 public: | |
28 // Caller retains ownership of |local_private_key|. | |
29 SimpleHostChannelAuthenticator(const std::string& local_cert, | |
30 crypto::RSAPrivateKey* local_private_key, | |
Wez
2011/11/22 22:29:48
Can this parameter be const&?
Sergey Ulanov
2011/11/23 01:23:42
Currently net::CreateSSLServerSocket() expects non
| |
31 const std::string& shared_secret); | |
32 virtual ~SimpleHostChannelAuthenticator(); | |
33 | |
34 // ChannelAuthenticator implementation. | |
Wez
2011/11/22 22:29:48
nit: implementation -> interface?
Sergey Ulanov
2011/11/23 01:23:42
Done.
| |
35 virtual void SecureAndAuthenticate( | |
36 net::StreamSocket* socket, const DoneCallback& done_callback) OVERRIDE; | |
37 | |
38 private: | |
39 void OnConnected(int result); | |
40 void DoAuthRead(); | |
41 void OnAuthBytesRead(int result); | |
42 bool HandleAuthBytesRead(int result); | |
43 bool VerifyAuthBytes(const std::string& received_auth_bytes); | |
44 | |
45 std::string local_cert_; | |
46 crypto::RSAPrivateKey* local_private_key_; | |
47 std::string shared_secret_; | |
48 std::string auth_bytes_; | |
Wez
2011/11/22 22:29:48
Why store |auth_bytes_|, rather than deriving it f
Sergey Ulanov
2011/11/23 01:23:42
Done.
| |
49 scoped_ptr<net::SSLServerSocket> socket_; | |
50 DoneCallback done_callback_; | |
51 | |
52 scoped_refptr<net::GrowableIOBuffer> auth_read_buf_; | |
53 | |
54 net::OldCompletionCallbackImpl<SimpleHostChannelAuthenticator> | |
55 connect_callback_; | |
56 net::OldCompletionCallbackImpl<SimpleHostChannelAuthenticator> | |
57 auth_read_callback_; | |
58 | |
59 DISALLOW_COPY_AND_ASSIGN(SimpleHostChannelAuthenticator); | |
60 }; | |
61 | |
62 } // namespace protocol | |
63 } // namespace remoting | |
64 | |
65 #endif // REMOTING_PROTOCOL_SIMPLE_HOST_CHANNEL_AUTHENTICATOR_H_ | |
OLD | NEW |