OLD | NEW |
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 Loading... |
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 net::x509_util::CreateSelfSignedCert( | 96 net::x509_util::CreateSha1SelfSignedCert( |
97 key_.get(), | 97 key_.get(), |
98 "CN=chromoting", | 98 "CN=chromoting", |
99 base::RandInt(1, std::numeric_limits<int>::max()), | 99 base::RandInt(1, std::numeric_limits<int>::max()), |
100 base::Time::Now(), | 100 base::Time::Now(), |
101 base::Time::Now() + base::TimeDelta::FromDays(1), | 101 base::Time::Now() + base::TimeDelta::FromDays(1), |
102 &der_cert); | 102 &der_cert); |
103 return der_cert; | 103 return der_cert; |
104 } | 104 } |
105 | 105 |
106 } // namespace remoting | 106 } // namespace remoting |
OLD | NEW |