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

Unified Diff: net/socket/ssl_server_socket.h

Issue 994743003: Support for client certs in ssl_server_socket. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: net/socket/ssl_server_socket.h
diff --git a/net/socket/ssl_server_socket.h b/net/socket/ssl_server_socket.h
index 88f7f94143956764cb67b32dc2e7667136b38b9f..708065d4bf68dd51f4ef9eb35b5b8107a3723e65 100644
--- a/net/socket/ssl_server_socket.h
+++ b/net/socket/ssl_server_socket.h
@@ -5,12 +5,15 @@
#ifndef NET_SOCKET_SSL_SERVER_SOCKET_H_
#define NET_SOCKET_SSL_SERVER_SOCKET_H_
+#include <vector>
+
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "net/base/completion_callback.h"
#include "net/base/net_export.h"
#include "net/socket/ssl_socket.h"
#include "net/socket/stream_socket.h"
+#include "net/ssl/ssl_client_cert_type.h"
namespace crypto {
class RSAPrivateKey;
@@ -18,8 +21,10 @@ class RSAPrivateKey;
namespace net {
+class CertVerifier;
struct SSLConfig;
class X509Certificate;
+typedef std::vector<scoped_refptr<X509Certificate>> CertificateList;
Ryan Sleevi 2015/03/19 04:38:24 ODR VIOLATION: Don't do duplicate typedefs like th
davidben 2015/03/25 00:05:33 That's actually how we forward-declare that typede
Ryan Sleevi 2015/03/25 00:14:08 Any place that is doing that is buggy; this isn't
class SSLServerSocket : public SSLSocket {
public:
@@ -30,6 +35,37 @@ class SSLServerSocket : public SSLSocket {
// completion then the callback will be silently, as for other StreamSocket
// calls.
virtual int Handshake(const CompletionCallback& callback) = 0;
+
davidben 2015/03/25 00:05:33 These APIs are very dangerous because of the globa
+ // Indicates whether a client certificate is to be allowed by the upcoming
+ // Handshake.
+ virtual void SetAllowClientCert(bool allow_client_cert) = 0;
Ryan Sleevi 2015/03/19 04:38:24 The client is not allowed to presumptively send a
+
+ // Provides the list of certificates whose names are to be included in the
+ // CertificateRequest handshake message. Calling this function is only useful
+ // if certificates are allowed.
+ virtual void SetClientCertCAList(
+ const CertificateList& client_cert_ca_list) = 0;
Ryan Sleevi 2015/03/19 04:38:24 I'd prefer this actually be part of the constructi
+
+ // Indicates that a client certificate is not only allowed but required, and
+ // provides the CertificateVerifier that is to be used to verify it during the
+ // handshake. The |client_cert_verifier| continues to be owned by the caller,
+ // and must exist at least until the handshake has completed.
+ // This function is meaningful only if client certificates are allowed.
+ // NOTES:
+ // 1. If no CertificateVerifier is provided, then a client certificate may
+ // still be allowed (if ssl_config.send_client_cert is true), but in that case
+ // verification must be done after the handshake has completed, by which time
+ // the session will have been cached, and may be subject to resumption.
+ // 2. The |client_cert_verifier| must provide its response synchronously, and
+ // blocks the IO thread while it runs. This results from a limitation of NSS.
+ // If ERR_IO_PENDING is returned, this is considered a verification failure.
+ // 3. For verifying a client certificate, the CertVerifier::Verify method
+ // will be called with input parameters as follows:
+ // - cert: the cert to be verified
+ // - hostname: empty string
+ // - flags: 0
+ // - crl_set: NULL
+ virtual void SetClientCertVerifier(CertVerifier* client_cert_verifier) = 0;
Ryan Sleevi 2015/03/19 04:38:24 From a design level, I don't think I'm comfortable
};
// Configures the underlying SSL library for the use of SSL server sockets.

Powered by Google App Engine
This is Rietveld 408576698