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

Side by Side Diff: trunk/src/google_apis/cup/client_update_protocol.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "google_apis/cup/client_update_protocol.h" 5 #include "google_apis/cup/client_update_protocol.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/sha1.h" 10 #include "base/sha1.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 result.insert(result.end(), digest.begin(), digest.end()); 115 result.insert(result.end(), digest.begin(), digest.end());
116 DCHECK_EQ(result.size(), rsa_key_size); 116 DCHECK_EQ(result.size(), rsa_key_size);
117 return result; 117 return result;
118 } 118 }
119 119
120 // CUP passes the versioned secret in the query portion of the URL for the 120 // CUP passes the versioned secret in the query portion of the URL for the
121 // update check service -- and that means that a URL-safe variant of Base64 is 121 // update check service -- and that means that a URL-safe variant of Base64 is
122 // needed. Call the standard Base64 encoder/decoder and then apply fixups. 122 // needed. Call the standard Base64 encoder/decoder and then apply fixups.
123 std::string UrlSafeB64Encode(const std::vector<uint8>& data) { 123 std::string UrlSafeB64Encode(const std::vector<uint8>& data) {
124 std::string result; 124 std::string result;
125 base::Base64Encode(ByteVectorToSP(data), &result); 125 if (!base::Base64Encode(ByteVectorToSP(data), &result))
126 return std::string();
126 127
127 // Do an tr|+/|-_| on the output, and strip any '=' padding. 128 // Do an tr|+/|-_| on the output, and strip any '=' padding.
128 for (std::string::iterator it = result.begin(); it != result.end(); ++it) { 129 for (std::string::iterator it = result.begin(); it != result.end(); ++it) {
129 switch (*it) { 130 switch (*it) {
130 case '+': 131 case '+':
131 *it = '-'; 132 *it = '-';
132 break; 133 break;
133 case '/': 134 case '/':
134 *it = '_'; 135 *it = '_';
135 break; 136 break;
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 295
295 // Encrypt the key source (r) using the public key (pk[v]) to generate the 296 // Encrypt the key source (r) using the public key (pk[v]) to generate the
296 // encrypted key source (w). 297 // encrypted key source (w).
297 if (!EncryptKeySource(source)) 298 if (!EncryptKeySource(source))
298 return false; 299 return false;
299 if (encrypted_key_source_.size() != PublicKeyLength()) 300 if (encrypted_key_source_.size() != PublicKeyLength())
300 return false; 301 return false;
301 302
302 return true; 303 return true;
303 } 304 }
305
OLDNEW
« no previous file with comments | « trunk/src/extensions/common/extension.cc ('k') | trunk/src/google_apis/gaia/oauth_request_signer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698