Index: content/browser/media/webrtc_identity_store.cc |
=================================================================== |
--- content/browser/media/webrtc_identity_store.cc (revision 228925) |
+++ content/browser/media/webrtc_identity_store.cc (working copy) |
@@ -39,26 +39,23 @@ |
result->error = net::OK; |
int serial_number = base::RandInt(0, std::numeric_limits<int>::max()); |
- scoped_ptr<crypto::RSAPrivateKey> key(crypto::RSAPrivateKey::Create(1024)); |
- if (!key.get()) { |
- DLOG(ERROR) << "Unable to create key pair for client"; |
- result->error = net::ERR_KEY_GENERATION_FAILED; |
- return; |
- } |
- |
+ crypto::RSAPrivateKey* raw_key; |
base::Time now = base::Time::Now(); |
- bool success = net::x509_util::CreateSelfSignedCert(key.get(), |
- "CN=" + common_name, |
- serial_number, |
- now, |
- now + validity_period, |
- &result->certificate); |
+ bool success = net::x509_util::CreateKeyAndSelfSignedCert( |
+ "CN=" + common_name, |
+ serial_number, |
+ now, |
+ now + validity_period, |
+ &raw_key, |
+ &result->certificate); |
+ |
if (!success) { |
DLOG(ERROR) << "Unable to create x509 cert for client"; |
result->error = net::ERR_SELF_SIGNED_CERT_GENERATION_FAILED; |
return; |
} |
+ scoped_ptr<crypto::RSAPrivateKey> key(raw_key); |
std::vector<uint8> private_key_info; |
if (!key->ExportPrivateKey(&private_key_info)) { |
DLOG(ERROR) << "Unable to export private key"; |