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

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

Issue 101113004: Revert 239759 "The comment in base64.h implies that base::Base64..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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 | Annotate | Revision Log
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 base::Base64Encode(key_str, &key_base64); 66 if (!base::Base64Encode(key_str, &key_base64)) {
67 LOG(FATAL) << "Base64Encode failed";
68 }
67 return key_base64; 69 return key_base64;
68 } 70 }
69 71
70 std::string RsaKeyPair::GetPublicKey() const { 72 std::string RsaKeyPair::GetPublicKey() const {
71 std::vector<uint8> public_key; 73 std::vector<uint8> public_key;
72 CHECK(key_->ExportPublicKey(&public_key)); 74 CHECK(key_->ExportPublicKey(&public_key));
73 std::string public_key_str(public_key.begin(), public_key.end()); 75 std::string public_key_str(public_key.begin(), public_key.end());
74 std::string public_key_base64; 76 std::string public_key_base64;
75 base::Base64Encode(public_key_str, &public_key_base64); 77 base::Base64Encode(public_key_str, &public_key_base64);
76 return public_key_base64; 78 return public_key_base64;
(...skipping 22 matching lines...) Expand all
99 net::x509_util::DIGEST_SHA1, 101 net::x509_util::DIGEST_SHA1,
100 "CN=chromoting", 102 "CN=chromoting",
101 base::RandInt(1, std::numeric_limits<int>::max()), 103 base::RandInt(1, std::numeric_limits<int>::max()),
102 base::Time::Now(), 104 base::Time::Now(),
103 base::Time::Now() + base::TimeDelta::FromDays(1), 105 base::Time::Now() + base::TimeDelta::FromDays(1),
104 &der_cert); 106 &der_cert);
105 return der_cert; 107 return der_cert;
106 } 108 }
107 109
108 } // namespace remoting 110 } // namespace remoting
OLDNEW
« no previous file with comments | « trunk/src/net/websockets/websocket_handshake_handler.cc ('k') | trunk/src/remoting/host/pin_hash.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698