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

Unified Diff: chrome/browser/ui/views/certificate_viewer_win.cc

Issue 7324039: Ensure X509Certificate::OSCertHandles are safe to be used on both UI and IO threads on Win (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 2 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
« no previous file with comments | « chrome/browser/ui/cocoa/certificate_viewer.mm ('k') | net/base/scoped_cert_chain_context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/certificate_viewer_win.cc
diff --git a/chrome/browser/ui/views/certificate_viewer_win.cc b/chrome/browser/ui/views/certificate_viewer_win.cc
index ba54267100e94e820eaaca1da10b65bedfbacd9d..9e5007c7a2bd4025fc7446a7783ef3e1e8e09b16 100644
--- a/chrome/browser/ui/views/certificate_viewer_win.cc
+++ b/chrome/browser/ui/views/certificate_viewer_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,10 +8,16 @@
#include <cryptuiapi.h>
#pragma comment(lib, "cryptui.lib")
+#include "base/logging.h"
#include "net/base/x509_certificate.h"
void ShowCertificateViewer(gfx::NativeWindow parent,
net::X509Certificate* cert) {
+ // Create a new cert context and store containing just the certificate
+ // and its intermediate certificates.
+ PCCERT_CONTEXT cert_list = cert->CreateOSCertChainForCert();
+ CHECK(cert_list);
+
CRYPTUI_VIEWCERTIFICATE_STRUCT view_info = { 0 };
view_info.dwSize = sizeof(view_info);
// We set our parent to the tab window. This makes the cert dialog created
@@ -19,9 +25,8 @@ void ShowCertificateViewer(gfx::NativeWindow parent,
view_info.hwndParent = parent;
view_info.dwFlags = CRYPTUI_DISABLE_EDITPROPERTIES |
CRYPTUI_DISABLE_ADDTOSTORE;
- view_info.pCertContext = cert->os_cert_handle();
- // Search the cert store that 'cert' is in when building the cert chain.
- HCERTSTORE cert_store = view_info.pCertContext->hCertStore;
+ view_info.pCertContext = cert_list;
+ HCERTSTORE cert_store = cert_list->hCertStore;
view_info.cStores = 1;
view_info.rghStores = &cert_store;
BOOL properties_changed;
@@ -29,4 +34,6 @@ void ShowCertificateViewer(gfx::NativeWindow parent,
// This next call blocks but keeps processing windows messages, making it
// modal to the browser window.
BOOL rv = ::CryptUIDlgViewCertificate(&view_info, &properties_changed);
+
+ CertFreeCertificateContext(cert_list);
}
« no previous file with comments | « chrome/browser/ui/cocoa/certificate_viewer.mm ('k') | net/base/scoped_cert_chain_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698