summaryrefslogtreecommitdiffstats
path: root/remoting/protocol/jingle_session.h
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-01 23:26:36 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-01 23:26:36 +0000
commitc6a4563a5f7734e12056cfc386b611a827e7645e (patch)
tree8e13bd0299ec77fb9dd3a0fc859035f495328ba7 /remoting/protocol/jingle_session.h
parent4599b65cb24f991a551b976ec1b6fa4be1aa9f8d (diff)
downloadchromium_src-c6a4563a5f7734e12056cfc386b611a827e7645e.zip
chromium_src-c6a4563a5f7734e12056cfc386b611a827e7645e.tar.gz
chromium_src-c6a4563a5f7734e12056cfc386b611a827e7645e.tar.bz2
Initial key exchange implementation.
BUG=None TEST=Unittests. Review URL: http://codereview.chromium.org/7006029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87547 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/protocol/jingle_session.h')
-rw-r--r--remoting/protocol/jingle_session.h57
1 files changed, 36 insertions, 21 deletions
diff --git a/remoting/protocol/jingle_session.h b/remoting/protocol/jingle_session.h
index 3775d68..a48dc10 100644
--- a/remoting/protocol/jingle_session.h
+++ b/remoting/protocol/jingle_session.h
@@ -41,17 +41,6 @@ class JingleSession : public protocol::Session,
public:
static const char kChromotingContentName[];
- // Create a JingleSession used in client mode. A server certificate is
- // required.
- static JingleSession* CreateClientSession(JingleSessionManager* manager);
-
- // Create a JingleSession used in server mode. A server certificate and
- // private key is provided. |key| is copied in the constructor.
- static JingleSession* CreateServerSession(
- JingleSessionManager* manager,
- scoped_refptr<net::X509Certificate> certificate,
- crypto::RSAPrivateKey* key);
-
// Chromotocol Session interface.
virtual void SetStateChangeCallback(StateChangeCallback* callback);
@@ -65,6 +54,8 @@ class JingleSession : public protocol::Session,
virtual const std::string& jid();
virtual MessageLoop* message_loop();
+ virtual const CandidateSessionConfig* candidate_config();
+
virtual const SessionConfig* config();
virtual void set_config(const SessionConfig* config);
@@ -73,23 +64,37 @@ class JingleSession : public protocol::Session,
virtual const std::string& receiver_token();
virtual void set_receiver_token(const std::string& receiver_token);
- // These fields are only set on the receiving side.
- virtual const CandidateSessionConfig* candidate_config();
-
virtual void Close(Task* closed_task);
private:
friend class JingleSessionManager;
- JingleSession(JingleSessionManager* client,
- scoped_refptr<net::X509Certificate> server_cert,
- crypto::RSAPrivateKey* key);
+ // Create a JingleSession used in client mode. A server certificate is
+ // required.
+ static JingleSession* CreateClientSession(JingleSessionManager* manager,
+ const std::string& host_public_key);
+
+ // Create a JingleSession used in server mode. A server certificate and
+ // private key is provided. |key| is copied in the constructor.
+ //
+ // TODO(sergeyu): Remove |certificate| and |key| when we stop using TLS.
+ static JingleSession* CreateServerSession(
+ JingleSessionManager* manager,
+ scoped_refptr<net::X509Certificate> certificate,
+ crypto::RSAPrivateKey* key);
+
+ // TODO(sergeyu): Change type of |peer_public_key| to RSAPublicKey.
+ JingleSession(JingleSessionManager* jingle_session_manager,
+ scoped_refptr<net::X509Certificate> local_cert,
+ crypto::RSAPrivateKey* local_private_key,
+ const std::string& peer_public_key);
virtual ~JingleSession();
// Called by JingleSessionManager.
void set_candidate_config(const CandidateSessionConfig* candidate_config);
- scoped_refptr<net::X509Certificate> server_certificate() const;
+ scoped_refptr<net::X509Certificate> local_certificate() const;
void Init(cricket::Session* cricket_session);
+ std::string GetEncryptedMasterKey() const;
// Close all the channels and terminate the session.
void CloseInternal(int result, bool failed);
@@ -136,11 +141,21 @@ class JingleSession : public protocol::Session,
// JingleSessionManager that created this session.
scoped_refptr<JingleSessionManager> jingle_session_manager_;
- // Server certificate used in SSL connections.
- scoped_refptr<net::X509Certificate> server_cert_;
+ // Certificates used for connection. Currently only receiving side
+ // has a certificate.
+ scoped_refptr<net::X509Certificate> local_cert_;
+ scoped_refptr<net::X509Certificate> remote_cert_;
// Private key used in SSL server sockets.
- scoped_ptr<crypto::RSAPrivateKey> key_;
+ scoped_ptr<crypto::RSAPrivateKey> local_private_key_;
+
+ // Public key of the peer.
+ std::string peer_public_key_;
+
+ // Master key used to derive ice keys for each ice
+ // session. Generated on the client and sent to the host in the
+ // session-initiate message (encrypted with the host's key).
+ std::string master_key_;
State state_;
scoped_ptr<StateChangeCallback> state_change_callback_;