| OLD | NEW |
| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 case '+': | 131 case '+': |
| 132 *it = '-'; | 132 *it = '-'; |
| 133 break; | 133 break; |
| 134 case '/': | 134 case '/': |
| 135 *it = '_'; | 135 *it = '_'; |
| 136 break; | 136 break; |
| 137 default: | 137 default: |
| 138 break; | 138 break; |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 TrimString(result, "=", &result); | 141 base::TrimString(result, "=", &result); |
| 142 | 142 |
| 143 return result; | 143 return result; |
| 144 } | 144 } |
| 145 | 145 |
| 146 std::vector<uint8> UrlSafeB64Decode(const base::StringPiece& input) { | 146 std::vector<uint8> UrlSafeB64Decode(const base::StringPiece& input) { |
| 147 std::string unsafe(input.begin(), input.end()); | 147 std::string unsafe(input.begin(), input.end()); |
| 148 for (std::string::iterator it = unsafe.begin(); it != unsafe.end(); ++it) { | 148 for (std::string::iterator it = unsafe.begin(); it != unsafe.end(); ++it) { |
| 149 switch (*it) { | 149 switch (*it) { |
| 150 case '-': | 150 case '-': |
| 151 *it = '+'; | 151 *it = '+'; |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 // 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 |
| 297 // encrypted key source (w). | 297 // encrypted key source (w). |
| 298 if (!EncryptKeySource(source)) | 298 if (!EncryptKeySource(source)) |
| 299 return false; | 299 return false; |
| 300 if (encrypted_key_source_.size() != PublicKeyLength()) | 300 if (encrypted_key_source_.size() != PublicKeyLength()) |
| 301 return false; | 301 return false; |
| 302 | 302 |
| 303 return true; | 303 return true; |
| 304 } | 304 } |
| 305 | 305 |
| OLD | NEW |