OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/host/host_key_pair.h" | 5 #include "remoting/host/host_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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 CHECK(key_->ExportPrivateKey(&key_bytes)); | 93 CHECK(key_->ExportPrivateKey(&key_bytes)); |
94 return crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_bytes); | 94 return crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_bytes); |
95 } | 95 } |
96 | 96 |
97 std::string HostKeyPair::GenerateCertificate() const { | 97 std::string HostKeyPair::GenerateCertificate() const { |
98 scoped_refptr<net::X509Certificate> cert = | 98 scoped_refptr<net::X509Certificate> cert = |
99 net::X509Certificate::CreateSelfSigned( | 99 net::X509Certificate::CreateSelfSigned( |
100 key_.get(), "CN=chromoting", | 100 key_.get(), "CN=chromoting", |
101 base::RandInt(1, std::numeric_limits<int>::max()), | 101 base::RandInt(1, std::numeric_limits<int>::max()), |
102 base::TimeDelta::FromDays(1)); | 102 base::TimeDelta::FromDays(1)); |
103 std::string result; | 103 std::string encoded; |
104 CHECK(cert->GetDEREncoded(&result)); | 104 bool result = net::X509Certificate::GetDEREncoded(cert->os_cert_handle(), |
105 return result; | 105 &encoded); |
| 106 CHECK(result); |
| 107 return encoded; |
106 } | 108 } |
107 | 109 |
108 } // namespace remoting | 110 } // namespace remoting |
OLD | NEW |