| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extensions/api/networking_private/crypto_verify_impl.h" | 5 #include "chrome/browser/extensions/api/networking_private/crypto_verify_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/sequenced_task_runner.h" | 12 #include "base/sequenced_task_runner.h" |
| 13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/strings/string_piece.h" |
| 14 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 15 #include "base/threading/sequenced_worker_pool.h" | 16 #include "base/threading/sequenced_worker_pool.h" |
| 16 #include "base/threading/thread_task_runner_handle.h" | 17 #include "base/threading/thread_task_runner_handle.h" |
| 17 #include "chrome/browser/extensions/api/networking_private/networking_private_cr
edentials_getter.h" | 18 #include "chrome/browser/extensions/api/networking_private/networking_private_cr
edentials_getter.h" |
| 18 #include "chrome/browser/extensions/api/networking_private/networking_private_cr
ypto.h" | 19 #include "chrome/browser/extensions/api/networking_private/networking_private_cr
ypto.h" |
| 19 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 20 #include "extensions/browser/api/networking_private/networking_private_api.h" | 21 #include "extensions/browser/api/networking_private/networking_private_api.h" |
| 21 #include "extensions/browser/api/networking_private/networking_private_service_c
lient.h" | 22 #include "extensions/browser/api/networking_private/networking_private_service_c
lient.h" |
| 22 #include "extensions/common/api/networking_private.h" | 23 #include "extensions/common/api/networking_private.h" |
| 23 | 24 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 | 160 |
| 160 } // namespace | 161 } // namespace |
| 161 | 162 |
| 162 CryptoVerifyImpl::Credentials::Credentials( | 163 CryptoVerifyImpl::Credentials::Credentials( |
| 163 const VerificationProperties& properties) { | 164 const VerificationProperties& properties) { |
| 164 certificate = properties.certificate; | 165 certificate = properties.certificate; |
| 165 if (properties.intermediate_certificates.get()) | 166 if (properties.intermediate_certificates.get()) |
| 166 intermediate_certificates = *properties.intermediate_certificates; | 167 intermediate_certificates = *properties.intermediate_certificates; |
| 167 signed_data = properties.signed_data; | 168 signed_data = properties.signed_data; |
| 168 | 169 |
| 169 std::vector<std::string> data_parts; | 170 unsigned_data = base::JoinString( |
| 170 data_parts.push_back(properties.device_ssid); | 171 {properties.device_ssid, properties.device_serial, |
| 171 data_parts.push_back(properties.device_serial); | 172 properties.device_bssid, properties.public_key, properties.nonce}, |
| 172 data_parts.push_back(properties.device_bssid); | 173 ","); |
| 173 data_parts.push_back(properties.public_key); | |
| 174 data_parts.push_back(properties.nonce); | |
| 175 unsigned_data = base::JoinString(data_parts, ","); | |
| 176 | 174 |
| 177 device_bssid = properties.device_bssid; | 175 device_bssid = properties.device_bssid; |
| 178 public_key = properties.public_key; | 176 public_key = properties.public_key; |
| 179 } | 177 } |
| 180 | 178 |
| 181 CryptoVerifyImpl::Credentials::Credentials(const Credentials& other) = default; | 179 CryptoVerifyImpl::Credentials::Credentials(const Credentials& other) = default; |
| 182 | 180 |
| 183 CryptoVerifyImpl::Credentials::~Credentials() { | 181 CryptoVerifyImpl::Credentials::~Credentials() { |
| 184 } | 182 } |
| 185 | 183 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 232 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 235 Credentials credentials(verification_properties); | 233 Credentials credentials(verification_properties); |
| 236 base::PostTaskAndReplyWithResult( | 234 base::PostTaskAndReplyWithResult( |
| 237 blocking_pool_task_runner_.get(), FROM_HERE, | 235 blocking_pool_task_runner_.get(), FROM_HERE, |
| 238 base::Bind(&DoVerifyAndEncryptData, credentials, data), | 236 base::Bind(&DoVerifyAndEncryptData, credentials, data), |
| 239 base::Bind(&VerifyAndEncryptDataCompleted, success_callback, | 237 base::Bind(&VerifyAndEncryptDataCompleted, success_callback, |
| 240 failure_callback)); | 238 failure_callback)); |
| 241 } | 239 } |
| 242 | 240 |
| 243 } // namespace extensions | 241 } // namespace extensions |
| OLD | NEW |