| 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 "net/quic/chromium/crypto/channel_id_chromium.h" | 5 #include "net/quic/chromium/crypto/channel_id_chromium.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "crypto/ec_private_key.h" | 12 #include "crypto/ec_private_key.h" |
| 13 #include "crypto/ec_signature_creator.h" | 13 #include "crypto/ec_signature_creator.h" |
| 14 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
| 15 #include "net/cert/asn1_util.h" | 15 #include "net/cert/asn1_util.h" |
| 16 #include "net/ssl/channel_id_service.h" | 16 #include "net/ssl/channel_id_service.h" |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 | 19 |
| 20 ChannelIDKeyChromium::ChannelIDKeyChromium( | 20 ChannelIDKeyChromium::ChannelIDKeyChromium( |
| 21 std::unique_ptr<crypto::ECPrivateKey> ec_private_key) | 21 std::unique_ptr<crypto::ECPrivateKey> ec_private_key) |
| 22 : ec_private_key_(std::move(ec_private_key)) {} | 22 : ec_private_key_(std::move(ec_private_key)) {} |
| 23 | 23 |
| 24 ChannelIDKeyChromium::~ChannelIDKeyChromium() {} | 24 ChannelIDKeyChromium::~ChannelIDKeyChromium() {} |
| 25 | 25 |
| 26 bool ChannelIDKeyChromium::Sign(base::StringPiece signed_data, | 26 bool ChannelIDKeyChromium::Sign(QuicStringPiece signed_data, |
| 27 std::string* out_signature) const { | 27 std::string* out_signature) const { |
| 28 std::unique_ptr<crypto::ECSignatureCreator> sig_creator( | 28 std::unique_ptr<crypto::ECSignatureCreator> sig_creator( |
| 29 crypto::ECSignatureCreator::Create(ec_private_key_.get())); | 29 crypto::ECSignatureCreator::Create(ec_private_key_.get())); |
| 30 if (!sig_creator) { | 30 if (!sig_creator) { |
| 31 return false; | 31 return false; |
| 32 } | 32 } |
| 33 const size_t len1 = strlen(ChannelIDVerifier::kContextStr) + 1; | 33 const size_t len1 = strlen(ChannelIDVerifier::kContextStr) + 1; |
| 34 const size_t len2 = strlen(ChannelIDVerifier::kClientToServerStr) + 1; | 34 const size_t len2 = strlen(ChannelIDVerifier::kClientToServerStr) + 1; |
| 35 std::vector<uint8_t> data(len1 + len2 + signed_data.size()); | 35 std::vector<uint8_t> data(len1 + len2 + signed_data.size()); |
| 36 memcpy(&data[0], ChannelIDVerifier::kContextStr, len1); | 36 memcpy(&data[0], ChannelIDVerifier::kContextStr, len1); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 active_jobs_[job_ptr] = std::move(job); | 214 active_jobs_[job_ptr] = std::move(job); |
| 215 } | 215 } |
| 216 return status; | 216 return status; |
| 217 } | 217 } |
| 218 | 218 |
| 219 void ChannelIDSourceChromium::OnJobComplete(Job* job) { | 219 void ChannelIDSourceChromium::OnJobComplete(Job* job) { |
| 220 active_jobs_.erase(job); | 220 active_jobs_.erase(job); |
| 221 } | 221 } |
| 222 | 222 |
| 223 } // namespace net | 223 } // namespace net |
| OLD | NEW |