summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-21 22:45:54 +0000
committerrsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-21 22:45:54 +0000
commitf83c54e1a387b379164cc10b9f095f80fbded06c (patch)
tree2cdc172e94ed18a62b9e4351891fd543a4ddc5d7
parentbad77bf7b76ecaa884dd1cba56eeefd94e219c30 (diff)
downloadchromium_src-f83c54e1a387b379164cc10b9f095f80fbded06c.zip
chromium_src-f83c54e1a387b379164cc10b9f095f80fbded06c.tar.gz
chromium_src-f83c54e1a387b379164cc10b9f095f80fbded06c.tar.bz2
Remove dependency on X509Certificate::Cache behaviour when selecting a client certificate on Win
On OS X and Linux (cocoa/gtk), the original X509Certificate pointer supplied in SSLCertRequestInfo's client_certs is the one returned when a user selects a certificate. On Windows, a new X509Certificate is created from the selected certificate and returned, rather than the original X509Certificate. This translates to a dependency on X509Certificate::Cache to return the same certificate, which, while presently is true, is an implementation specific detail that should not be relied upon. BUG=none TEST=SSL client authentication continues to work on Windows Review URL: http://codereview.chromium.org/3170019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57003 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/views/ssl_client_certificate_selector_win.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/chrome/browser/views/ssl_client_certificate_selector_win.cc b/chrome/browser/views/ssl_client_certificate_selector_win.cc
index 8977787..d78151d 100644
--- a/chrome/browser/views/ssl_client_certificate_selector_win.cc
+++ b/chrome/browser/views/ssl_client_certificate_selector_win.cc
@@ -26,7 +26,6 @@ void ShowSSLClientCertificateSelector(
TabContents* parent,
net::SSLCertRequestInfo* cert_request_info,
SSLClientAuthHandler* delegate) {
- net::X509Certificate* cert = NULL;
// TODO(jcampan): replace this with our own cert selection dialog.
// CryptUIDlgSelectCertificateFromStore is blocking (but still processes
// Windows messages), which is scary.
@@ -51,11 +50,17 @@ void ShowSSLClientCertificateSelector(
client_certs, parent->GetMessageBoxRootWindow(),
title.c_str(), text.c_str(), 0, 0, NULL);
+ net::X509Certificate* cert = NULL;
if (cert_context) {
- cert = net::X509Certificate::CreateFromHandle(
- cert_context,
- net::X509Certificate::SOURCE_LONE_CERT_IMPORT,
- net::X509Certificate::OSCertHandles());
+ for (size_t i = 0; i < cert_request_info->client_certs.size(); ++i) {
+ net::X509Certificate* client_cert = cert_request_info->client_certs[i];
+ if (net::X509Certificate::IsSameOSCert(cert_context,
+ client_cert->os_cert_handle())) {
+ cert = client_cert;
+ break;
+ }
+ }
+ DCHECK(cert != NULL);
net::X509Certificate::FreeOSCertHandle(cert_context);
}