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" |
11 #include "base/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "base/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "crypto/hmac.h" | 13 #include "crypto/hmac.h" |
14 #include "crypto/random.h" | 14 #include "crypto/random.h" |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 base::StringPiece ByteVectorToSP(const std::vector<uint8>& vec) { | 18 base::StringPiece ByteVectorToSP(const std::vector<uint8>& vec) { |
19 if (vec.empty()) | 19 if (vec.empty()) |
20 return base::StringPiece(); | 20 return base::StringPiece(); |
21 | 21 |
22 return base::StringPiece(reinterpret_cast<const char*>(&vec[0]), vec.size()); | 22 return base::StringPiece(reinterpret_cast<const char*>(&vec[0]), vec.size()); |
(...skipping 273 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 |