Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: net/http/http_network_transaction.cc

Issue 2337253004: Update Token Binding code to the latest drafts (Closed)
Patch Set: Add call to CBS_len() Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/http/http_basic_stream.cc ('k') | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "net/http/http_network_transaction.h" 5 #include "net/http/http_network_transaction.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 1015
1016 response_.did_use_http_auth = 1016 response_.did_use_http_auth =
1017 request_headers_.HasHeader(HttpRequestHeaders::kAuthorization) || 1017 request_headers_.HasHeader(HttpRequestHeaders::kAuthorization) ||
1018 request_headers_.HasHeader(HttpRequestHeaders::kProxyAuthorization); 1018 request_headers_.HasHeader(HttpRequestHeaders::kProxyAuthorization);
1019 return OK; 1019 return OK;
1020 } 1020 }
1021 1021
1022 int HttpNetworkTransaction::BuildTokenBindingHeader(std::string* out) { 1022 int HttpNetworkTransaction::BuildTokenBindingHeader(std::string* out) {
1023 base::TimeTicks start = base::TimeTicks::Now(); 1023 base::TimeTicks start = base::TimeTicks::Now();
1024 std::vector<uint8_t> signed_ekm; 1024 std::vector<uint8_t> signed_ekm;
1025 int rv = stream_->GetSignedEKMForTokenBinding( 1025 int rv = stream_->GetTokenBindingSignature(provided_token_binding_key_.get(),
1026 provided_token_binding_key_.get(), &signed_ekm); 1026 TokenBindingType::PROVIDED,
1027 &signed_ekm);
1027 if (rv != OK) 1028 if (rv != OK)
1028 return rv; 1029 return rv;
1029 std::string provided_token_binding; 1030 std::string provided_token_binding;
1030 rv = BuildTokenBinding(TokenBindingType::PROVIDED, 1031 rv = BuildTokenBinding(TokenBindingType::PROVIDED,
1031 provided_token_binding_key_.get(), signed_ekm, 1032 provided_token_binding_key_.get(), signed_ekm,
1032 &provided_token_binding); 1033 &provided_token_binding);
1033 if (rv != OK) 1034 if (rv != OK)
1034 return rv; 1035 return rv;
1035 1036
1036 std::vector<base::StringPiece> token_bindings; 1037 std::vector<base::StringPiece> token_bindings;
1037 token_bindings.push_back(provided_token_binding); 1038 token_bindings.push_back(provided_token_binding);
1038 1039
1039 std::string referred_token_binding; 1040 std::string referred_token_binding;
1040 if (referred_token_binding_key_) { 1041 if (referred_token_binding_key_) {
1041 std::vector<uint8_t> referred_signed_ekm; 1042 std::vector<uint8_t> referred_signed_ekm;
1042 int rv = stream_->GetSignedEKMForTokenBinding( 1043 int rv = stream_->GetTokenBindingSignature(
1043 referred_token_binding_key_.get(), &referred_signed_ekm); 1044 referred_token_binding_key_.get(), TokenBindingType::REFERRED,
1045 &referred_signed_ekm);
1044 if (rv != OK) 1046 if (rv != OK)
1045 return rv; 1047 return rv;
1046 rv = BuildTokenBinding(TokenBindingType::REFERRED, 1048 rv = BuildTokenBinding(TokenBindingType::REFERRED,
1047 referred_token_binding_key_.get(), 1049 referred_token_binding_key_.get(),
1048 referred_signed_ekm, &referred_token_binding); 1050 referred_signed_ekm, &referred_token_binding);
1049 if (rv != OK) 1051 if (rv != OK)
1050 return rv; 1052 return rv;
1051 token_bindings.push_back(referred_token_binding); 1053 token_bindings.push_back(referred_token_binding);
1052 } 1054 }
1053 std::string header; 1055 std::string header;
1054 rv = BuildTokenBindingMessageFromTokenBindings(token_bindings, &header); 1056 rv = BuildTokenBindingMessageFromTokenBindings(token_bindings, &header);
1055 if (rv != OK) 1057 if (rv != OK)
1056 return rv; 1058 return rv;
1057 base::Base64UrlEncode(header, base::Base64UrlEncodePolicy::INCLUDE_PADDING, 1059 base::Base64UrlEncode(header, base::Base64UrlEncodePolicy::OMIT_PADDING, out);
1058 out);
1059 base::TimeDelta header_creation_time = base::TimeTicks::Now() - start; 1060 base::TimeDelta header_creation_time = base::TimeTicks::Now() - start;
1060 UMA_HISTOGRAM_CUSTOM_TIMES("Net.TokenBinding.HeaderCreationTime", 1061 UMA_HISTOGRAM_CUSTOM_TIMES("Net.TokenBinding.HeaderCreationTime",
1061 header_creation_time, 1062 header_creation_time,
1062 base::TimeDelta::FromMilliseconds(1), 1063 base::TimeDelta::FromMilliseconds(1),
1063 base::TimeDelta::FromMinutes(1), 50); 1064 base::TimeDelta::FromMinutes(1), 50);
1064 return OK; 1065 return OK;
1065 } 1066 }
1066 1067
1067 int HttpNetworkTransaction::DoInitRequestBody() { 1068 int HttpNetworkTransaction::DoInitRequestBody() {
1068 next_state_ = STATE_INIT_REQUEST_BODY_COMPLETE; 1069 next_state_ = STATE_INIT_REQUEST_BODY_COMPLETE;
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
1629 DCHECK(stream_request_); 1630 DCHECK(stream_request_);
1630 1631
1631 // Since the transaction can restart with auth credentials, it may create a 1632 // Since the transaction can restart with auth credentials, it may create a
1632 // stream more than once. Accumulate all of the connection attempts across 1633 // stream more than once. Accumulate all of the connection attempts across
1633 // those streams by appending them to the vector: 1634 // those streams by appending them to the vector:
1634 for (const auto& attempt : stream_request_->connection_attempts()) 1635 for (const auto& attempt : stream_request_->connection_attempts())
1635 connection_attempts_.push_back(attempt); 1636 connection_attempts_.push_back(attempt);
1636 } 1637 }
1637 1638
1638 } // namespace net 1639 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_basic_stream.cc ('k') | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698