| 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 if (!base::Base64Encode(hmac, &hmac_base64)) { | 169 base::Base64Encode(hmac, &hmac_base64); |
| 170 NOTREACHED(); | |
| 171 return; | |
| 172 } | |
| 173 if (hmac_base64.size() != BASE64_PER_RAW(kHMACSizeInBytes)) { | 170 if (hmac_base64.size() != BASE64_PER_RAW(kHMACSizeInBytes)) { |
| 174 NOTREACHED(); | 171 NOTREACHED(); |
| 175 return; | 172 return; |
| 176 } | 173 } |
| 177 DCHECK(hmac_base64.size() < result.size()); | 174 DCHECK(hmac_base64.size() < result.size()); |
| 178 std::copy(hmac_base64.begin(), hmac_base64.end(), result.begin()); | 175 std::copy(hmac_base64.begin(), hmac_base64.end(), result.begin()); |
| 179 | 176 |
| 180 std::string tick_decimal = base::Uint64ToString(tick); | 177 std::string tick_decimal = base::Uint64ToString(tick); |
| 181 DCHECK(tick_decimal.size() <= kTickStringLength); | 178 DCHECK(tick_decimal.size() <= kTickStringLength); |
| 182 std::copy( | 179 std::copy( |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 const std::string& domain, const VarValueMap& var_value_map) { | 465 const std::string& domain, const VarValueMap& var_value_map) { |
| 469 return g_generation_service.Get().GeneratePassport(domain, var_value_map, 0); | 466 return g_generation_service.Get().GeneratePassport(domain, var_value_map, 0); |
| 470 } | 467 } |
| 471 | 468 |
| 472 // static | 469 // static |
| 473 void InternalAuthGeneration::GenerateNewKey() { | 470 void InternalAuthGeneration::GenerateNewKey() { |
| 474 g_generation_service.Get().GenerateNewKey(); | 471 g_generation_service.Get().GenerateNewKey(); |
| 475 } | 472 } |
| 476 | 473 |
| 477 } // namespace chrome | 474 } // namespace chrome |
| OLD | NEW |