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

Side by Side Diff: net/socket/ssl_client_socket.h

Issue 1474983003: Support for client certs in ssl_server_socket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
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 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_H_ 5 #ifndef NET_SOCKET_SSL_CLIENT_SOCKET_H_
6 #define NET_SOCKET_SSL_CLIENT_SOCKET_H_ 6 #define NET_SOCKET_SSL_CLIENT_SOCKET_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
11 #include "net/base/completion_callback.h" 11 #include "net/base/completion_callback.h"
12 #include "net/base/load_flags.h" 12 #include "net/base/load_flags.h"
13 #include "net/base/net_errors.h" 13 #include "net/base/net_errors.h"
14 #include "net/socket/ssl_socket.h" 14 #include "net/socket/ssl_socket.h"
15 #include "net/socket/stream_socket.h" 15 #include "net/socket/stream_socket.h"
16 #include "net/ssl/ssl_failure_state.h" 16 #include "net/ssl/ssl_failure_state.h"
17 17
18 namespace net { 18 namespace net {
19 19
20 class CertPolicyEnforcer; 20 class CertPolicyEnforcer;
21 class CertVerifier; 21 class CertVerifier;
22 class ChannelIDService; 22 class ChannelIDService;
23 class CTVerifier; 23 class CTVerifier;
24 class SSLCertRequestInfo; 24 class SSLCertRequestInfo;
25 struct SSLConfig; 25 struct SSLConfig;
26 class SSLInfo; 26 class SSLInfo;
27 class SSLPrivateKey;
27 class TransportSecurityState; 28 class TransportSecurityState;
28 class X509Certificate; 29 class X509Certificate;
29 30
30 // This struct groups together several fields which are used by various 31 // This struct groups together several fields which are used by various
31 // classes related to SSLClientSocket. 32 // classes related to SSLClientSocket.
32 struct SSLClientSocketContext { 33 struct SSLClientSocketContext {
33 SSLClientSocketContext() 34 SSLClientSocketContext()
34 : cert_verifier(NULL), 35 : cert_verifier(NULL),
35 channel_id_service(NULL), 36 channel_id_service(NULL),
36 transport_security_state(NULL), 37 transport_security_state(NULL),
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 // Determine if the TLS version required by Section 9.2 of the HTTP/2 175 // Determine if the TLS version required by Section 9.2 of the HTTP/2
175 // specification is enabled. Note that the server might still pick an 176 // specification is enabled. Note that the server might still pick an
176 // inadequate TLS version. 177 // inadequate TLS version.
177 static bool IsTLSVersionAdequateForHTTP2(const SSLConfig& ssl_config); 178 static bool IsTLSVersionAdequateForHTTP2(const SSLConfig& ssl_config);
178 179
179 // Serialize |next_protos| in the wire format for ALPN and NPN: protocols are 180 // Serialize |next_protos| in the wire format for ALPN and NPN: protocols are
180 // listed in order, each prefixed by a one-byte length. 181 // listed in order, each prefixed by a one-byte length.
181 static std::vector<uint8_t> SerializeNextProtos( 182 static std::vector<uint8_t> SerializeNextProtos(
182 const NextProtoVector& next_protos); 183 const NextProtoVector& next_protos);
183 184
185 // For unit testing only.
186 // Specify a client certificate and the RSA private key to be used with it.
187 virtual void ForceClientCertificateAndKeyForTesting(
188 const scoped_refptr<X509Certificate>& client_cert,
189 scoped_ptr<SSLPrivateKey> client_private_key) {}
davidben 2015/12/01 22:35:17 This should no longer be necessary if you rebase.
ryanchung 2015/12/02 23:57:03 Awesome. Done.
190
184 private: 191 private:
185 FRIEND_TEST_ALL_PREFIXES(SSLClientSocket, SerializeNextProtos); 192 FRIEND_TEST_ALL_PREFIXES(SSLClientSocket, SerializeNextProtos);
186 // For signed_cert_timestamps_received_ and stapled_ocsp_response_received_. 193 // For signed_cert_timestamps_received_ and stapled_ocsp_response_received_.
187 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, 194 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest,
188 ConnectSignedCertTimestampsEnabledTLSExtension); 195 ConnectSignedCertTimestampsEnabledTLSExtension);
189 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, 196 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest,
190 ConnectSignedCertTimestampsEnabledOCSP); 197 ConnectSignedCertTimestampsEnabledOCSP);
191 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, 198 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest,
192 ConnectSignedCertTimestampsDisabled); 199 ConnectSignedCertTimestampsDisabled);
193 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest, 200 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketTest,
194 VerifyServerChainProperlyOrdered); 201 VerifyServerChainProperlyOrdered);
202 friend class SSLServerSocketTest;
195 203
196 // True if SCTs were received via a TLS extension. 204 // True if SCTs were received via a TLS extension.
197 bool signed_cert_timestamps_received_; 205 bool signed_cert_timestamps_received_;
198 // True if a stapled OCSP response was received. 206 // True if a stapled OCSP response was received.
199 bool stapled_ocsp_response_received_; 207 bool stapled_ocsp_response_received_;
200 // Protocol negotiation extension used. 208 // Protocol negotiation extension used.
201 SSLNegotiationExtension negotiation_extension_; 209 SSLNegotiationExtension negotiation_extension_;
202 }; 210 };
203 211
204 } // namespace net 212 } // namespace net
205 213
206 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_ 214 #endif // NET_SOCKET_SSL_CLIENT_SOCKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698