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

Unified Diff: content/browser/media/webrtc_identity_store.cc

Issue 27832002: Sign self-signed certs with SHA256. (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
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";

Powered by Google App Engine
This is Rietveld 408576698