| OLD | NEW |
| 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 "chrome/browser/internal_auth.h" | 5 #include "chrome/browser/internal_auth.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <deque> | 8 #include <deque> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 blob += tmp + kItemSeparator + base::Uint64ToString(tick); | 159 blob += tmp + kItemSeparator + base::Uint64ToString(tick); |
| 160 | 160 |
| 161 std::string hmac; | 161 std::string hmac; |
| 162 unsigned char* hmac_data = reinterpret_cast<unsigned char*>( | 162 unsigned char* hmac_data = reinterpret_cast<unsigned char*>( |
| 163 WriteInto(&hmac, kHMACSizeInBytes + 1)); | 163 WriteInto(&hmac, kHMACSizeInBytes + 1)); |
| 164 if (!engine->Sign(blob, hmac_data, kHMACSizeInBytes)) { | 164 if (!engine->Sign(blob, hmac_data, kHMACSizeInBytes)) { |
| 165 NOTREACHED(); | 165 NOTREACHED(); |
| 166 return; | 166 return; |
| 167 } | 167 } |
| 168 std::string hmac_base64; | 168 std::string hmac_base64; |
| 169 base::Base64Encode(hmac, &hmac_base64); | 169 if (!base::Base64Encode(hmac, &hmac_base64)) { |
| 170 NOTREACHED(); |
| 171 return; |
| 172 } |
| 170 if (hmac_base64.size() != BASE64_PER_RAW(kHMACSizeInBytes)) { | 173 if (hmac_base64.size() != BASE64_PER_RAW(kHMACSizeInBytes)) { |
| 171 NOTREACHED(); | 174 NOTREACHED(); |
| 172 return; | 175 return; |
| 173 } | 176 } |
| 174 DCHECK(hmac_base64.size() < result.size()); | 177 DCHECK(hmac_base64.size() < result.size()); |
| 175 std::copy(hmac_base64.begin(), hmac_base64.end(), result.begin()); | 178 std::copy(hmac_base64.begin(), hmac_base64.end(), result.begin()); |
| 176 | 179 |
| 177 std::string tick_decimal = base::Uint64ToString(tick); | 180 std::string tick_decimal = base::Uint64ToString(tick); |
| 178 DCHECK(tick_decimal.size() <= kTickStringLength); | 181 DCHECK(tick_decimal.size() <= kTickStringLength); |
| 179 std::copy( | 182 std::copy( |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 const std::string& domain, const VarValueMap& var_value_map) { | 468 const std::string& domain, const VarValueMap& var_value_map) { |
| 466 return g_generation_service.Get().GeneratePassport(domain, var_value_map, 0); | 469 return g_generation_service.Get().GeneratePassport(domain, var_value_map, 0); |
| 467 } | 470 } |
| 468 | 471 |
| 469 // static | 472 // static |
| 470 void InternalAuthGeneration::GenerateNewKey() { | 473 void InternalAuthGeneration::GenerateNewKey() { |
| 471 g_generation_service.Get().GenerateNewKey(); | 474 g_generation_service.Get().GenerateNewKey(); |
| 472 } | 475 } |
| 473 | 476 |
| 474 } // namespace chrome | 477 } // namespace chrome |
| OLD | NEW |