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

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

Issue 7038053: Implementation of SecureP2PSocket (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use Encryptor CTR Created 9 years, 6 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 | Annotate | Revision Log
OLDNEW
(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 // Implement a secure P2P socket according to the W3C spec
6 //
7 // "Video conferencing and peer-to-peer communication"
8 // http://www.whatwg.org/specs/web-apps/current-work/complete/video-conferencing -and-peer-to-peer-communication.html#peer-to-peer-connections
9 //
10 // This class operates on an establish socket to perform encryption for P2P
11 // connection. This class does not perform chunking for outgoing buffers, all
12 // outgoing buffers have to be 44 bytes smaller than MTU to allow space for
13 // header to support encryption.
14
15 #ifndef REMOTING_PROTOCOL_SECURE_P2P_SOCKET_H_
16 #define REMOTING_PROTOCOL_SOCKET_P2P_SOCKET_H_
17
18 #include <string>
19
20 #include "base/memory/ref_counted.h"
21 #include "base/memory/scoped_ptr.h"
22 #include "crypto/encryptor.h"
23 #include "crypto/hmac.h"
24 #include "net/socket/socket.h"
25
26 namespace crypto {
27 class SymmetricKey;
28 } // namespace crypto
29
30 namespace net {
31 class IOBufferWithSize;
32 } // namespace net
33
34 namespace remoting {
35 namespace protocol {
36
37 class SecureP2PSocket : public net::Socket {
38 public:
39 SecureP2PSocket(net::Socket* socket, const std::string& ice_key);
40
41 // Socket implementation.
42 virtual int Read(net::IOBuffer* buf, int buf_len,
43 net::CompletionCallback* callback);
44 virtual int Write(net::IOBuffer* buf, int buf_len,
45 net::CompletionCallback* callback);
46 virtual bool SetReceiveBufferSize(int32 size);
47 virtual bool SetSendBufferSize(int32 size);
48
49 private:
50 int ReadInternal();
51 void ReadDone(int err);
52 void WriteDone(int err);
53 int DecryptBuffer(int size);
54
55 net::Socket* socket_;
Sergey Ulanov 2011/06/22 23:51:35 SSL socket objects own underlying physical sockets
Alpha Left Google 2011/06/23 21:53:01 Done.
56
57 uint64 write_seq_;
58 uint64 read_seq_;
59
60 net::CompletionCallback* user_read_callback_;
61 scoped_refptr<net::IOBuffer> user_read_buf_;
62 int user_read_buf_len_;
63
64 net::CompletionCallback* user_write_callback_;
65 int user_write_buf_len_;
66
67 scoped_ptr<net::CompletionCallback> read_callback_;
68 scoped_refptr<net::IOBufferWithSize> read_buf_;
69
70 scoped_ptr<net::CompletionCallback> write_callback_;
71
72 scoped_ptr<crypto::SymmetricKey> mask_key_;
73 crypto::HMAC msg_hasher_;
74 crypto::Encryptor encryptor_;
75
76 DISALLOW_COPY_AND_ASSIGN(SecureP2PSocket);
77 };
78
79 } // namespace protocol
80 } // namespace remoting
81
82 #endif // REMOTING_PROTOCOL_SOCKET_P2P_SOCKET_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/protocol/secure_p2p_socket.cc » ('j') | remoting/protocol/secure_p2p_socket.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698