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

Side by Side Diff: net/cert/x509_certificate_ios.cc

Issue 1988993002: Check self-signed certificate names and signatures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove dependency on openssl -text format Created 4 years, 6 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
« no previous file with comments | « no previous file | net/cert/x509_certificate_nss.cc » ('j') | 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) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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/cert/x509_certificate.h" 5 #include "net/cert/x509_certificate.h"
6 6
7 #include <CommonCrypto/CommonDigest.h> 7 #include <CommonCrypto/CommonDigest.h>
8 #include <Security/Security.h> 8 #include <Security/Security.h>
9 9
10 #include <openssl/x509.h> 10 #include <openssl/x509.h>
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 } 459 }
460 460
461 // static 461 // static
462 bool X509Certificate::IsSelfSigned(OSCertHandle os_cert) { 462 bool X509Certificate::IsSelfSigned(OSCertHandle os_cert) {
463 ScopedX509 cert = OSCertHandleToOpenSSL(os_cert); 463 ScopedX509 cert = OSCertHandleToOpenSSL(os_cert);
464 if (!cert) 464 if (!cert)
465 return false; 465 return false;
466 crypto::ScopedEVP_PKEY scoped_key(X509_get_pubkey(cert.get())); 466 crypto::ScopedEVP_PKEY scoped_key(X509_get_pubkey(cert.get()));
467 if (!scoped_key) 467 if (!scoped_key)
468 return false; 468 return false;
469 469 if (!X509_verify(cert.get(), scoped_key.get()))
470 // NOTE: X509_verify() returns 1 in case of success, 0 or -1 on error. 470 return false;
471 return X509_verify(cert.get(), scoped_key.get()) == 1; 471 return X509_check_issued(cert.get(), cert.get()) == X509_V_OK;
472 } 472 }
473 473
474 } // namespace net 474 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/cert/x509_certificate_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698