Index: chrome/browser/ui/cocoa/certificate_viewer.mm |
diff --git a/chrome/browser/ui/cocoa/certificate_viewer.mm b/chrome/browser/ui/cocoa/certificate_viewer.mm |
index 8c5a9545dc075aafb18db35b6cb6b71d41e1f9dc..723ccfd221cf81b25585d0614f9571cd676a6268 100644 |
--- a/chrome/browser/ui/cocoa/certificate_viewer.mm |
+++ b/chrome/browser/ui/cocoa/certificate_viewer.mm |
@@ -34,12 +34,58 @@ void ShowCertificateViewer(gfx::NativeWindow parent, |
for (size_t i = 0; i < ca_certs.size(); ++i) |
CFArrayAppendValue(certificates, ca_certs[i]); |
- [[[SFCertificatePanel alloc] init] |
- beginSheetForWindow:parent |
- modalDelegate:nil |
- didEndSelector:NULL |
- contextInfo:NULL |
- certificates:reinterpret_cast<NSArray*>(certificates.get()) |
- showGroup:YES]; |
+ // Explicitly disable revocation checking, regardless of user preferences or |
+ // system settings. The behaviour of SFCertificatePanel is to call |
+ // SecTrustEvaluate on the certificate(s) supplied, effectively duplicating |
+ // the behaviour of net::X509Certificate::Verify(). However, the call is |
+ // made in such a way as to stall the UI while doing so. If an OCSP |
wtc
2011/06/03 01:58:04
Nit: just say "However, the call stalls the UI."
|
+ // responder or CRL source is experiencing delays and/or is unreachable, |
+ // this may cause long stalls in the UI. By disabling revocation checking, |
+ // the intent is to minimize these stalls to the lesser of the evils, which |
+ // is the time taken for path building and verification, which should be |
+ // optimized based on the certificates supplied in |certificates|. This does |
+ // not affect normal revocation checking, which is controlled by |
+ // net::X509Certificate::Verify() and user preferences, so revoked |
+ // certificates will still be processed. This does, however, prevent the UI |
+ // from displaying which certificate in the chain was the revoked |
+ // certificate if net::X509Certificate::Verify() had previously been called |
+ // with revocation checking enabled. For the time being, this is an |
wtc
2011/06/03 01:58:04
Nit: remove "For the time being".
(This comment b
|
+ // acceptable trade-off. |
+ base::mac::ScopedCFTypeRef<CFMutableArrayRef> policies( |
+ CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks)); |
+ if (!policies.get()) { |
+ NOTREACHED(); |
+ return; |
+ } |
+ OSStatus status = |
+ net::X509Certificate::CreateRevocationPolicies(false, policies); |
+ |
+ // In addition to revocation policies, it's necessary to re-add the basic |
+ // X.509 policy that the SFCertificatePanel applies when no policies are |
+ // explicitly provided. Because only the base X.509 policy is applied, |
+ // any errors that are specific to SSL (such as invalid EKU or mismatched |
+ // hostname and name identifiers) will not be displayed in the certificate |
wtc
2011/06/03 01:58:04
Nit: just say "certificate name mismatch". "name
|
+ // viewer if the user is viewing an SSL server certificate. |
wtc
2011/06/03 01:58:04
Does the ordering of the policies matter? I wonde
Ryan Sleevi
2011/06/21 03:52:25
Functionally, it doesn't, but I went ahead and mad
|
+ if (!status) { |
wtc
2011/06/03 01:58:04
Nit: use
if (status == noErr)
and
if (status !
|
+ SecPolicyRef basic_policy = NULL; |
+ status = net::X509Certificate::CreateBasicX509Policy(&basic_policy); |
+ if (!status) { |
+ CFArrayAppendValue(policies, basic_policy); |
+ CFRelease(basic_policy); |
+ } |
+ } |
+ if (status) { |
+ NOTREACHED(); |
+ return; |
+ } |
+ |
+ SFCertificatePanel* panel = [[SFCertificatePanel alloc] init]; |
+ [panel setPolicies:(id)policies.get()]; |
+ [panel beginSheetForWindow:parent |
+ modalDelegate:nil |
+ didEndSelector:NULL |
+ contextInfo:NULL |
+ certificates:reinterpret_cast<NSArray*>(certificates.get()) |
+ showGroup:YES]; |
// The SFCertificatePanel releases itself when the sheet is dismissed. |
} |