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

Unified Diff: net/base/x509_chain_mac.cc

Issue 3146034: Allow the constructed certificate chain to be returned in CertVerifyResult (Closed)
Patch Set: Created 10 years, 4 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 | « net/base/x509_chain.h ('k') | net/base/x509_chain_nss.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/x509_chain_mac.cc
diff --git a/net/base/x509_chain_mac.cc b/net/base/x509_chain_mac.cc
index b1503f9faff66d19bd56305366d4caa71c4aebe9..b50cddabf31c28094566a5c26b41ea2f77793c58 100644
--- a/net/base/x509_chain_mac.cc
+++ b/net/base/x509_chain_mac.cc
@@ -290,6 +290,21 @@ int VerifySSLServer(X509Certificate* certificate, const std::string& hostname,
return NetErrorFromOSStatus(status);
scoped_cftyperef<CFArrayRef> scoped_completed_chain(completed_chain);
+ // Copy the certificate chain, regardless of the results, if requested.
+ if (flags & VERIFY_RETURN_CHAIN) {
+ X509Certificate::OSCertHandles intermediates;
+ for (CFIndex i = 1, count = CFArrayGetCount(completed_chain); i < count;
+ ++i) {
+ intermediates.push_back(reinterpret_cast<SecCertificateRef>(
+ const_cast<void*>(CFArrayGetValueAtIndex(completed_chain, i))));
+ }
+
+ SecCertificateRef server_cert = reinterpret_cast<SecCertificateRef>(
+ const_cast<void*>(CFArrayGetValueAtIndex(completed_chain, 0)));
+ verify_result->certificate = X509Certificate::CreateFromHandle(
+ server_cert, intermediates);
+ }
+
// Evaluate the results
OSStatus cssm_result;
bool got_certificate_error = false;
« no previous file with comments | « net/base/x509_chain.h ('k') | net/base/x509_chain_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698