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

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

Issue 86913002: Make base::Base64Encode() return void (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: One more chromeos-specific fix. Created 7 years 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
« no previous file with comments | « net/websockets/websocket_handshake_handler.cc ('k') | remoting/host/pin_hash.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 57
58 std::string RsaKeyPair::ToString() const { 58 std::string RsaKeyPair::ToString() const {
59 // Check that the key initialized. 59 // Check that the key initialized.
60 DCHECK(key_.get() != NULL); 60 DCHECK(key_.get() != NULL);
61 61
62 std::vector<uint8> key_buf; 62 std::vector<uint8> key_buf;
63 CHECK(key_->ExportPrivateKey(&key_buf)); 63 CHECK(key_->ExportPrivateKey(&key_buf));
64 std::string key_str(key_buf.begin(), key_buf.end()); 64 std::string key_str(key_buf.begin(), key_buf.end());
65 std::string key_base64; 65 std::string key_base64;
66 if (!base::Base64Encode(key_str, &key_base64)) { 66 base::Base64Encode(key_str, &key_base64);
67 LOG(FATAL) << "Base64Encode failed";
68 }
69 return key_base64; 67 return key_base64;
70 } 68 }
71 69
72 std::string RsaKeyPair::GetPublicKey() const { 70 std::string RsaKeyPair::GetPublicKey() const {
73 std::vector<uint8> public_key; 71 std::vector<uint8> public_key;
74 CHECK(key_->ExportPublicKey(&public_key)); 72 CHECK(key_->ExportPublicKey(&public_key));
75 std::string public_key_str(public_key.begin(), public_key.end()); 73 std::string public_key_str(public_key.begin(), public_key.end());
76 std::string public_key_base64; 74 std::string public_key_base64;
77 base::Base64Encode(public_key_str, &public_key_base64); 75 base::Base64Encode(public_key_str, &public_key_base64);
78 return public_key_base64; 76 return public_key_base64;
(...skipping 22 matching lines...) Expand all
101 net::x509_util::DIGEST_SHA1, 99 net::x509_util::DIGEST_SHA1,
102 "CN=chromoting", 100 "CN=chromoting",
103 base::RandInt(1, std::numeric_limits<int>::max()), 101 base::RandInt(1, std::numeric_limits<int>::max()),
104 base::Time::Now(), 102 base::Time::Now(),
105 base::Time::Now() + base::TimeDelta::FromDays(1), 103 base::Time::Now() + base::TimeDelta::FromDays(1),
106 &der_cert); 104 &der_cert);
107 return der_cert; 105 return der_cert;
108 } 106 }
109 107
110 } // namespace remoting 108 } // namespace remoting
OLDNEW
« no previous file with comments | « net/websockets/websocket_handshake_handler.cc ('k') | remoting/host/pin_hash.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698