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

Side by Side Diff: remoting/base/rsa_key_pair.cc

Issue 27832002: Sign self-signed certs with SHA256. (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/base/rsa_key_pair.h" 5 #include "remoting/base/rsa_key_pair.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 std::vector<uint8> signature_buf; 86 std::vector<uint8> signature_buf;
87 signature_creator->Final(&signature_buf); 87 signature_creator->Final(&signature_buf);
88 std::string signature_str(signature_buf.begin(), signature_buf.end()); 88 std::string signature_str(signature_buf.begin(), signature_buf.end());
89 std::string signature_base64; 89 std::string signature_base64;
90 base::Base64Encode(signature_str, &signature_base64); 90 base::Base64Encode(signature_str, &signature_base64);
91 return signature_base64; 91 return signature_base64;
92 } 92 }
93 93
94 std::string RsaKeyPair::GenerateCertificate() const { 94 std::string RsaKeyPair::GenerateCertificate() const {
95 std::string der_cert; 95 std::string der_cert;
96 // Certificates are SHA1-signed because |key_| has likely been used to sign
97 // with SHA1 previously, and you should not re-use a key for signing data with
98 // multiple signature algorithms.
Wez 2013/10/30 19:45:08 So should we be making arrangements to switch Chro
bemasc 2013/10/30 20:18:45 The important thing here is not really SHA1 vs. SH
Sergey Ulanov 2013/10/31 06:25:29 Why signing the same key with a different hash fun
96 net::x509_util::CreateSelfSignedCert( 99 net::x509_util::CreateSelfSignedCert(
97 key_.get(), 100 key_.get(),
101 net::x509_util::DIGEST_SHA1,
98 "CN=chromoting", 102 "CN=chromoting",
99 base::RandInt(1, std::numeric_limits<int>::max()), 103 base::RandInt(1, std::numeric_limits<int>::max()),
100 base::Time::Now(), 104 base::Time::Now(),
101 base::Time::Now() + base::TimeDelta::FromDays(1), 105 base::Time::Now() + base::TimeDelta::FromDays(1),
102 &der_cert); 106 &der_cert);
103 return der_cert; 107 return der_cert;
104 } 108 }
105 109
106 } // namespace remoting 110 } // namespace remoting
OLDNEW
« content/browser/media/webrtc_identity_store.cc ('K') | « net/ssl/server_bound_cert_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698