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

Side by Side Diff: net/base/cert_database_nss.cc

Issue 7272014: Mark untrusted certificates as such in Linux UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 9 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
« no previous file with comments | « net/base/cert_database.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "net/base/cert_database.h" 5 #include "net/base/cert_database.h"
6 6
7 #include <cert.h> 7 #include <cert.h>
8 #include <certdb.h> 8 #include <certdb.h>
9 #include <keyhi.h> 9 #include <keyhi.h>
10 #include <pk11pub.h> 10 #include <pk11pub.h>
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 trust.HasTrustedCA(PR_FALSE, PR_FALSE, PR_TRUE) * TRUSTED_OBJ_SIGN; 231 trust.HasTrustedCA(PR_FALSE, PR_FALSE, PR_TRUE) * TRUSTED_OBJ_SIGN;
232 case SERVER_CERT: 232 case SERVER_CERT:
233 return trust.HasTrustedPeer(PR_TRUE, PR_FALSE, PR_FALSE) * TRUSTED_SSL + 233 return trust.HasTrustedPeer(PR_TRUE, PR_FALSE, PR_FALSE) * TRUSTED_SSL +
234 trust.HasTrustedPeer(PR_FALSE, PR_TRUE, PR_FALSE) * TRUSTED_EMAIL + 234 trust.HasTrustedPeer(PR_FALSE, PR_TRUE, PR_FALSE) * TRUSTED_EMAIL +
235 trust.HasTrustedPeer(PR_FALSE, PR_FALSE, PR_TRUE) * TRUSTED_OBJ_SIGN; 235 trust.HasTrustedPeer(PR_FALSE, PR_FALSE, PR_TRUE) * TRUSTED_OBJ_SIGN;
236 default: 236 default:
237 return UNTRUSTED; 237 return UNTRUSTED;
238 } 238 }
239 } 239 }
240 240
241 bool CertDatabase::IsUntrusted(const X509Certificate* cert) const {
242 CERTCertTrust nsstrust;
243 SECStatus rv = CERT_GetCertTrust(cert->os_cert_handle(), &nsstrust);
244 if (rv != SECSuccess) {
245 LOG(ERROR) << "CERT_GetCertTrust failed with error " << PORT_GetError();
246 return false;
247 }
248
249 return nsstrust.sslFlags == 0 &&
250 nsstrust.emailFlags == 0 &&
251 nsstrust.objectSigningFlags == 0;
wtc 2011/09/12 23:57:04 agl: sorry for the very late reply. I got the ans
agl 2011/09/13 16:53:50 At least on my Ubuntu system I do have a distruste
wtc 2011/09/14 22:00:53 Yes. Unfortunately the MD5 Collisions Inc. CA in
wtc 2011/09/14 22:58:53 I examined the MD5 Collisions Inc. CA certficate i
252 }
253
241 bool CertDatabase::SetCertTrust(const X509Certificate* cert, 254 bool CertDatabase::SetCertTrust(const X509Certificate* cert,
242 CertType type, 255 CertType type,
243 unsigned int trusted) { 256 unsigned int trusted) {
244 bool success = psm::SetCertTrust(cert, type, trusted); 257 bool success = psm::SetCertTrust(cert, type, trusted);
245 if (success) 258 if (success)
246 CertDatabase::NotifyObserversOfCertTrustChanged(cert); 259 CertDatabase::NotifyObserversOfCertTrustChanged(cert);
247 260
248 return success; 261 return success;
249 } 262 }
250 263
(...skipping 19 matching lines...) Expand all
270 } 283 }
271 return true; 284 return true;
272 } 285 }
273 286
274 bool CertDatabase::IsReadOnly(const X509Certificate* cert) const { 287 bool CertDatabase::IsReadOnly(const X509Certificate* cert) const {
275 PK11SlotInfo* slot = cert->os_cert_handle()->slot; 288 PK11SlotInfo* slot = cert->os_cert_handle()->slot;
276 return slot && PK11_IsReadOnly(slot); 289 return slot && PK11_IsReadOnly(slot);
277 } 290 }
278 291
279 } // namespace net 292 } // namespace net
OLDNEW
« no previous file with comments | « net/base/cert_database.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698