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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 std::string result(kPassportSize, '0'); | 154 std::string result(kPassportSize, '0'); |
155 | 155 |
156 std::string blob; | 156 std::string blob; |
157 blob = domain + kItemSeparator; | 157 blob = domain + kItemSeparator; |
158 std::string tmp; | 158 std::string tmp; |
159 ConvertVarValueMapToBlob(map, &tmp); | 159 ConvertVarValueMapToBlob(map, &tmp); |
160 blob += tmp + kItemSeparator + base::Uint64ToString(tick); | 160 blob += tmp + kItemSeparator + base::Uint64ToString(tick); |
161 | 161 |
162 std::string hmac; | 162 std::string hmac; |
163 unsigned char* hmac_data = reinterpret_cast<unsigned char*>( | 163 unsigned char* hmac_data = reinterpret_cast<unsigned char*>( |
164 WriteInto(&hmac, kHMACSizeInBytes + 1)); | 164 base::WriteInto(&hmac, kHMACSizeInBytes + 1)); |
165 if (!engine->Sign(blob, hmac_data, kHMACSizeInBytes)) { | 165 if (!engine->Sign(blob, hmac_data, kHMACSizeInBytes)) { |
166 NOTREACHED(); | 166 NOTREACHED(); |
167 return; | 167 return; |
168 } | 168 } |
169 std::string hmac_base64; | 169 std::string hmac_base64; |
170 base::Base64Encode(hmac, &hmac_base64); | 170 base::Base64Encode(hmac, &hmac_base64); |
171 if (hmac_base64.size() != BASE64_PER_RAW(kHMACSizeInBytes)) { | 171 if (hmac_base64.size() != BASE64_PER_RAW(kHMACSizeInBytes)) { |
172 NOTREACHED(); | 172 NOTREACHED(); |
173 return; | 173 return; |
174 } | 174 } |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 const std::string& domain, const VarValueMap& var_value_map) { | 466 const std::string& domain, const VarValueMap& var_value_map) { |
467 return g_generation_service.Get().GeneratePassport(domain, var_value_map, 0); | 467 return g_generation_service.Get().GeneratePassport(domain, var_value_map, 0); |
468 } | 468 } |
469 | 469 |
470 // static | 470 // static |
471 void InternalAuthGeneration::GenerateNewKey() { | 471 void InternalAuthGeneration::GenerateNewKey() { |
472 g_generation_service.Get().GenerateNewKey(); | 472 g_generation_service.Get().GenerateNewKey(); |
473 } | 473 } |
474 | 474 |
475 } // namespace chrome | 475 } // namespace chrome |
OLD | NEW |