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

Side by Side Diff: chrome/browser/ui/android/website_settings_popup_android.cc

Issue 376753002: Fix webui cert viewer showing wrong cert chain on NSS and no chain on OpenSSL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/android/website_settings_popup_android.h" 5 #include "chrome/browser/ui/android/website_settings_popup_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "chrome/browser/android/resource_mapper.h" 10 #include "chrome/browser/android/resource_mapper.h"
(...skipping 26 matching lines...) Expand all
37 if (!web_contents) 37 if (!web_contents)
38 return NULL; 38 return NULL;
39 39
40 int cert_id = 40 int cert_id =
41 web_contents->GetController().GetVisibleEntry()->GetSSL().cert_id; 41 web_contents->GetController().GetVisibleEntry()->GetSSL().cert_id;
42 scoped_refptr<net::X509Certificate> cert; 42 scoped_refptr<net::X509Certificate> cert;
43 bool ok = CertStore::GetInstance()->RetrieveCert(cert_id, &cert); 43 bool ok = CertStore::GetInstance()->RetrieveCert(cert_id, &cert);
44 CHECK(ok); 44 CHECK(ok);
45 45
46 std::vector<std::string> cert_chain; 46 std::vector<std::string> cert_chain;
47 net::X509Certificate::OSCertHandles cert_handles = 47 net::X509Certificate::OSCertHandles cert_handles;
48 cert->GetIntermediateCertificates(); 48 cert->GetCertificateChain(&cert_handles);
49 // Make sure the peer's own cert is the first in the chain, if it's not
50 // already there.
51 if (cert_handles.empty() || cert_handles[0] != cert->os_cert_handle())
52 cert_handles.insert(cert_handles.begin(), cert->os_cert_handle());
53 49
54 cert_chain.reserve(cert_handles.size()); 50 cert_chain.reserve(cert_handles.size());
55 for (net::X509Certificate::OSCertHandles::const_iterator it = 51 for (net::X509Certificate::OSCertHandles::const_iterator it =
56 cert_handles.begin(); 52 cert_handles.begin();
57 it != cert_handles.end(); 53 it != cert_handles.end();
58 ++it) { 54 ++it) {
59 std::string cert_bytes; 55 std::string cert_bytes;
60 net::X509Certificate::GetDEREncoded(*it, &cert_bytes); 56 net::X509Certificate::GetDEREncoded(*it, &cert_bytes);
61 cert_chain.push_back(cert_bytes); 57 cert_chain.push_back(cert_bytes);
62 } 58 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 void WebsiteSettingsPopupAndroid::SetFirstVisit( 172 void WebsiteSettingsPopupAndroid::SetFirstVisit(
177 const base::string16& first_visit) { 173 const base::string16& first_visit) {
178 NOTIMPLEMENTED(); 174 NOTIMPLEMENTED();
179 } 175 }
180 176
181 // static 177 // static
182 bool WebsiteSettingsPopupAndroid::RegisterWebsiteSettingsPopupAndroid( 178 bool WebsiteSettingsPopupAndroid::RegisterWebsiteSettingsPopupAndroid(
183 JNIEnv* env) { 179 JNIEnv* env) {
184 return RegisterNativesImpl(env); 180 return RegisterNativesImpl(env);
185 } 181 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/certificate_dialogs.h » ('j') | chrome/browser/ui/certificate_dialogs.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698