Commit 74c3fb5f authored by hclam@chromium.org's avatar hclam@chromium.org

Use a random number to generate a self-signed certiciate for chromoting

Chromoting host to use a random number to generate self-signed certificate.
This method is still not optimal, in case of collision SSLServerSocketNSS will
fail to start due to NSS rejecting the certificate.

Using a random number is a temporary solution until we can assign certificates
to the host.

BUG=70013
TEST=Connect to the same chromoting host after client is disconnected.

Review URL: http://codereview.chromium.org/6315009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72745 0039d316-1c4b-4281-b951-d872f2087c98
parent a999ab29
...@@ -2,10 +2,13 @@ ...@@ -2,10 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include <limits>
#include "remoting/protocol/jingle_session_manager.h" #include "remoting/protocol/jingle_session_manager.h"
#include "base/base64.h" #include "base/base64.h"
#include "base/message_loop.h" #include "base/message_loop.h"
#include "base/rand_util.h"
#include "base/string_number_conversions.h" #include "base/string_number_conversions.h"
#include "remoting/base/constants.h" #include "remoting/base/constants.h"
#include "remoting/jingle_glue/jingle_thread.h" #include "remoting/jingle_glue/jingle_thread.h"
...@@ -282,7 +285,8 @@ void JingleSessionManager::OnSessionCreate( ...@@ -282,7 +285,8 @@ void JingleSessionManager::OnSessionCreate(
if (!certificate_) { if (!certificate_) {
private_key_.reset(base::RSAPrivateKey::Create(1024)); private_key_.reset(base::RSAPrivateKey::Create(1024));
certificate_ = net::X509Certificate::CreateSelfSigned( certificate_ = net::X509Certificate::CreateSelfSigned(
private_key_.get(), "CN=chromoting", 1, private_key_.get(), "CN=chromoting",
base::RandInt(1, std::numeric_limits<int>::max()),
base::TimeDelta::FromDays(1)); base::TimeDelta::FromDays(1));
CHECK(certificate_); CHECK(certificate_);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment