diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-11 20:56:07 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-11 20:56:07 +0000 |
commit | 77fcfdaf8229bb0ab82ebe7e823e6319b58cd74a (patch) | |
tree | efd1354cb1c6894648e066e9e022b8158419d375 /remoting | |
parent | 6c37dc9da790b86dcf99bb3802d6718786f87a5e (diff) | |
download | chromium_src-77fcfdaf8229bb0ab82ebe7e823e6319b58cd74a.zip chromium_src-77fcfdaf8229bb0ab82ebe7e823e6319b58cd74a.tar.gz chromium_src-77fcfdaf8229bb0ab82ebe7e823e6319b58cd74a.tar.bz2 |
Remove key exchange code from JingleSession.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/7616017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96451 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/protocol/content_description.cc | 33 | ||||
-rw-r--r-- | remoting/protocol/content_description.h | 5 | ||||
-rw-r--r-- | remoting/protocol/jingle_session.cc | 61 | ||||
-rw-r--r-- | remoting/protocol/jingle_session.h | 6 | ||||
-rw-r--r-- | remoting/protocol/jingle_session_manager.cc | 10 | ||||
-rw-r--r-- | remoting/protocol/jingle_session_manager.h | 3 |
6 files changed, 6 insertions, 112 deletions
diff --git a/remoting/protocol/content_description.cc b/remoting/protocol/content_description.cc index 8ea4f6b..d9b9477 100644 --- a/remoting/protocol/content_description.cc +++ b/remoting/protocol/content_description.cc @@ -31,7 +31,6 @@ const char kVideoTag[] = "video"; const char kResolutionTag[] = "initial-resolution"; const char kAuthenticationTag[] = "authentication"; const char kCertificateTag[] = "certificate"; -const char kMasterKeyTag[] = "master-key"; const char kAuthTokenTag[] = "auth-token"; const char kTransportAttr[] = "transport"; @@ -153,11 +152,9 @@ bool ParseChannelConfig(const XmlElement* element, bool codec_required, ContentDescription::ContentDescription( const CandidateSessionConfig* candidate_config, const std::string& auth_token, - const std::string& master_key, const std::string& certificate) : candidate_config_(candidate_config), auth_token_(auth_token), - master_key_(master_key), certificate_(certificate) { } @@ -172,8 +169,6 @@ ContentDescription::~ContentDescription() { } // <initial-resolution width="800" height="600" /> // <authentication> // <certificate>[BASE64 Encoded Certificate]</certificate> -// <master-key>[master key encrypted with hosts -// public key encoded with BASE64]</master-key> // <auth-token>...</auth-token> // IT2Me only. // </authentication> // </description> @@ -226,19 +221,6 @@ XmlElement* ContentDescription::ToXml() const { authentication_tag->AddElement(certificate_tag); } - if (!master_key().empty()) { - XmlElement* master_key_tag = new XmlElement( - QName(kChromotingXmlNamespace, kMasterKeyTag)); - - std::string master_key_base64; - if (!base::Base64Encode(master_key(), &master_key_base64)) { - LOG(DFATAL) << "Cannot perform base64 encode on master key"; - } - - master_key_tag->SetBodyText(master_key_base64); - authentication_tag->AddElement(master_key_tag); - } - if (!auth_token().empty()) { XmlElement* auth_token_tag = new XmlElement( QName(kChromotingXmlNamespace, kAuthTokenTag)); @@ -315,7 +297,6 @@ cricket::ContentDescription* ContentDescription::ParseXml( // Parse authentication information. std::string certificate; std::string auth_token; - std::string master_key; child = element->FirstNamed(QName(kChromotingXmlNamespace, kAuthenticationTag)); if (child) { @@ -330,17 +311,6 @@ cricket::ContentDescription* ContentDescription::ParseXml( } } - // Parse master-key. - const XmlElement* master_key_tag = - child->FirstNamed(QName(kChromotingXmlNamespace, kMasterKeyTag)); - if (master_key_tag) { - if (!base::Base64Decode(master_key_tag->BodyText(), &master_key)) { - LOG(ERROR) << "Failed to decode master-key received from the peer."; - return NULL; - } - master_key = master_key_tag->BodyText(); - } - // Parse auth-token. const XmlElement* auth_token_tag = child->FirstNamed(QName(kChromotingXmlNamespace, kAuthTokenTag)); @@ -349,8 +319,7 @@ cricket::ContentDescription* ContentDescription::ParseXml( } } - return new ContentDescription(config.release(), auth_token, master_key, - certificate); + return new ContentDescription(config.release(), auth_token, certificate); } LOG(ERROR) << "Invalid description: " << element->Str(); return NULL; diff --git a/remoting/protocol/content_description.h b/remoting/protocol/content_description.h index 678da31..b102480 100644 --- a/remoting/protocol/content_description.h +++ b/remoting/protocol/content_description.h @@ -28,7 +28,6 @@ class ContentDescription : public cricket::ContentDescription { public: ContentDescription(const CandidateSessionConfig* config, const std::string& auth_token, - const std::string& master_key, const std::string& certificate); virtual ~ContentDescription(); @@ -37,7 +36,6 @@ class ContentDescription : public cricket::ContentDescription { } const std::string& auth_token() const { return auth_token_; } - const std::string& master_key() const { return master_key_; } const std::string& certificate() const { return certificate_; } buzz::XmlElement* ToXml() const; @@ -51,9 +49,6 @@ class ContentDescription : public cricket::ContentDescription { // context. std::string auth_token_; - // Master key used for the session encrypted with the hosts key. - std::string master_key_; - std::string certificate_; }; diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc index f5ac3ab..3354ae0 100644 --- a/remoting/protocol/jingle_session.cc +++ b/remoting/protocol/jingle_session.cc @@ -34,54 +34,6 @@ namespace { const char kControlChannelName[] = "control"; const char kEventChannelName[] = "event"; -const int kMasterKeyLength = 16; -const int kChannelKeyLength = 16; - -std::string GenerateRandomMasterKey() { - std::string result; - result.resize(kMasterKeyLength); - base::RandBytes(&result[0], result.size()); - return result; -} - -std::string EncryptMasterKey(const std::string& host_public_key, - const std::string& master_key) { - // TODO(sergeyu): Implement RSA public key encryption in src/crypto - // and actually encrypt the key here. - return master_key; -} - -bool DecryptMasterKey(const crypto::RSAPrivateKey* private_key, - const std::string& encrypted_master_key, - std::string* master_key) { - // TODO(sergeyu): Implement RSA public key encryption in src/crypto - // and actually encrypt the key here. - *master_key = encrypted_master_key; - return true; -} - -// Generates channel key from master key and channel name. Must be -// used to generate channel key so that we don't use the same key for -// different channels. The key is calculated as -// HMAC_SHA256(master_key, channel_name) -bool GetChannelKey(const std::string& channel_name, - const std::string& master_key, - std::string* channel_key) { - crypto::HMAC hmac(crypto::HMAC::SHA256); - if (!hmac.Init(channel_name)) { - channel_key->clear(); - return false; - } - channel_key->resize(kChannelKeyLength); - if (!hmac.Sign(master_key, - reinterpret_cast<unsigned char*>(&(*channel_key)[0]), - channel_key->size())) { - channel_key->clear(); - return false; - } - return true; -} - } // namespace // static @@ -105,7 +57,6 @@ JingleSession::JingleSession( const std::string& peer_public_key) : jingle_session_manager_(jingle_session_manager), local_cert_(local_cert), - master_key_(GenerateRandomMasterKey()), state_(INITIALIZING), closed_(false), closing_(false), @@ -139,11 +90,6 @@ void JingleSession::Init(cricket::Session* cricket_session) { this, &JingleSession::OnSessionError); } -std::string JingleSession::GetEncryptedMasterKey() const { - DCHECK(CalledOnValidThread()); - return EncryptMasterKey(peer_public_key_, master_key_); -} - void JingleSession::CloseInternal(int result, bool failed) { DCHECK(CalledOnValidThread()); @@ -360,13 +306,6 @@ void JingleSession::OnInitiate() { static_cast<const protocol::ContentDescription*>( GetContentInfo()->description); CHECK(content_description); - - if (!DecryptMasterKey(local_private_key_.get(), - content_description->master_key(), &master_key_)) { - LOG(ERROR) << "Failed to decrypt master-key"; - CloseInternal(net::ERR_CONNECTION_FAILED, true); - return; - } } if (cricket_session_->initiator()) { diff --git a/remoting/protocol/jingle_session.h b/remoting/protocol/jingle_session.h index e4e3a6f..2336d5f 100644 --- a/remoting/protocol/jingle_session.h +++ b/remoting/protocol/jingle_session.h @@ -80,7 +80,6 @@ class JingleSession : public protocol::Session, void set_candidate_config(const CandidateSessionConfig* candidate_config); const std::string& 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); @@ -146,11 +145,6 @@ class JingleSession : public protocol::Session, // 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_; - // Shared secret to use in channel authentication. This is currently only // used in IT2Me. std::string shared_secret_; diff --git a/remoting/protocol/jingle_session_manager.cc b/remoting/protocol/jingle_session_manager.cc index 60defc1..c4ff55a 100644 --- a/remoting/protocol/jingle_session_manager.cc +++ b/remoting/protocol/jingle_session_manager.cc @@ -176,8 +176,7 @@ Session* JingleSessionManager::Connect( sessions_.push_back(jingle_session); cricket_session->Initiate(host_jid, CreateClientSessionDescription( - jingle_session->candidate_config()->Clone(), receiver_token, - jingle_session->GetEncryptedMasterKey())); + jingle_session->candidate_config()->Clone(), receiver_token)); return jingle_session; } @@ -332,12 +331,11 @@ bool JingleSessionManager::WriteContent( cricket::SessionDescription* JingleSessionManager::CreateClientSessionDescription( const CandidateSessionConfig* config, - const std::string& auth_token, - const std::string& master_key) { + const std::string& auth_token) { cricket::SessionDescription* desc = new cricket::SessionDescription(); desc->AddContent( JingleSession::kChromotingContentName, kChromotingXmlNamespace, - new ContentDescription(config, auth_token, master_key, "")); + new ContentDescription(config, auth_token, "")); return desc; } @@ -348,7 +346,7 @@ cricket::SessionDescription* JingleSessionManager::CreateHostSessionDescription( cricket::SessionDescription* desc = new cricket::SessionDescription(); desc->AddContent( JingleSession::kChromotingContentName, kChromotingXmlNamespace, - new ContentDescription(config, "", "", certificate)); + new ContentDescription(config, "", certificate)); return desc; } diff --git a/remoting/protocol/jingle_session_manager.h b/remoting/protocol/jingle_session_manager.h index d7a1d28..809a3e1 100644 --- a/remoting/protocol/jingle_session_manager.h +++ b/remoting/protocol/jingle_session_manager.h @@ -103,8 +103,7 @@ class JingleSessionManager // Creates session description for outgoing session. static cricket::SessionDescription* CreateClientSessionDescription( const CandidateSessionConfig* candidate_config, - const std::string& auth_token, - const std::string& master_key); + const std::string& auth_token); // Creates session description for incoming session. static cricket::SessionDescription* CreateHostSessionDescription( const CandidateSessionConfig* candidate_config, |