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

Unified Diff: chrome/browser/renderer_host/x509_user_cert_resource_handler.cc

Issue 6487012: Clear the SSL Client Auth cache when a new SSL Client Certificate is... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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: chrome/browser/renderer_host/x509_user_cert_resource_handler.cc
===================================================================
--- chrome/browser/renderer_host/x509_user_cert_resource_handler.cc (revision 74291)
+++ chrome/browser/renderer_host/x509_user_cert_resource_handler.cc (working copy)
@@ -14,9 +14,15 @@
#include "net/base/io_buffer.h"
#include "net/base/mime_sniffer.h"
#include "net/base/mime_util.h"
+#include "net/base/ssl_client_auth_cache.h"
#include "net/base/x509_certificate.h"
+#include "net/http/http_network_session.h"
#include "net/http/http_response_headers.h"
+#include "net/http/http_transaction_factory.h"
+#include "net/socket/client_socket_factory.h"
+#include "net/spdy/spdy_session_pool.h"
#include "net/url_request/url_request.h"
+#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_status.h"
X509UserCertResourceHandler::X509UserCertResourceHandler(
@@ -107,6 +113,20 @@
// The handler will run the UI and delete itself when it's finished.
new SSLAddCertHandler(request_, cert, render_process_host_id_,
render_view_id_);
+ // Force all new SSL connects to renegotiate, and hence use this new
+ // certificate if necessary.
+ if (request_->context()->http_transaction_factory()) {
+ net::HttpNetworkSession* session =
+ request_->context()->http_transaction_factory()->GetSession();
wtc 2011/02/15 20:50:40 It seems bad to expose so much internals of HttpNe
Ryan Hamilton 2011/02/16 17:44:40 Sounds reasonable. I move all this logic to a new
+ // Erase any mapping from host:port to client certificate.
+ session->ssl_client_auth_cache()->Clear();
+ // Clear any cached ssl sessions so that we do not resume with the old
+ // certificate.
+ net::ClientSocketFactory::ClearSSLSessionCache();
+ // Close all connections to force a reconnection.
+ session->FlushSocketPools();
+ session->spdy_session_pool()->CloseAllSessions();
+ }
return true;
}

Powered by Google App Engine
This is Rietveld 408576698