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

Side by Side Diff: net/cert/x509_certificate.h

Issue 634033002: Check whether or not a certificate is self-signed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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_ios.cc » ('j') | net/cert/x509_certificate_ios.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef NET_CERT_X509_CERTIFICATE_H_ 5 #ifndef NET_CERT_X509_CERTIFICATE_H_
6 #define NET_CERT_X509_CERTIFICATE_H_ 6 #define NET_CERT_X509_CERTIFICATE_H_
7 7
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 static SHA256HashValue CalculateCAFingerprint256( 414 static SHA256HashValue CalculateCAFingerprint256(
415 const OSCertHandles& intermediates); 415 const OSCertHandles& intermediates);
416 416
417 // Calculates the SHA-256 fingerprint for the complete chain, including the 417 // Calculates the SHA-256 fingerprint for the complete chain, including the
418 // leaf certificate and all intermediate CA certificates. Returns an empty 418 // leaf certificate and all intermediate CA certificates. Returns an empty
419 // (all zero) fingerprint on failure. 419 // (all zero) fingerprint on failure.
420 static SHA256HashValue CalculateChainFingerprint256( 420 static SHA256HashValue CalculateChainFingerprint256(
421 OSCertHandle leaf, 421 OSCertHandle leaf,
422 const OSCertHandles& intermediates); 422 const OSCertHandles& intermediates);
423 423
424 // Returns true if the certificate is self-signed.
425 static bool IsSelfSigned(OSCertHandle cert_handle);
426
424 private: 427 private:
425 friend class base::RefCountedThreadSafe<X509Certificate>; 428 friend class base::RefCountedThreadSafe<X509Certificate>;
426 friend class TestRootCerts; // For unit tests 429 friend class TestRootCerts; // For unit tests
427 430
428 FRIEND_TEST_ALL_PREFIXES(X509CertificateNameVerifyTest, VerifyHostname); 431 FRIEND_TEST_ALL_PREFIXES(X509CertificateNameVerifyTest, VerifyHostname);
429 FRIEND_TEST_ALL_PREFIXES(X509CertificateTest, SerialNumbers); 432 FRIEND_TEST_ALL_PREFIXES(X509CertificateTest, SerialNumbers);
430 433
431 // Construct an X509Certificate from a handle to the certificate object 434 // Construct an X509Certificate from a handle to the certificate object
432 // in the underlying crypto library. 435 // in the underlying crypto library.
433 X509Certificate(OSCertHandle cert_handle, 436 X509Certificate(OSCertHandle cert_handle,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 // based on the type of the certificate. 513 // based on the type of the certificate.
511 std::string default_nickname_; 514 std::string default_nickname_;
512 #endif 515 #endif
513 516
514 DISALLOW_COPY_AND_ASSIGN(X509Certificate); 517 DISALLOW_COPY_AND_ASSIGN(X509Certificate);
515 }; 518 };
516 519
517 } // namespace net 520 } // namespace net
518 521
519 #endif // NET_CERT_X509_CERTIFICATE_H_ 522 #endif // NET_CERT_X509_CERTIFICATE_H_
OLDNEW
« no previous file with comments | « no previous file | net/cert/x509_certificate_ios.cc » ('j') | net/cert/x509_certificate_ios.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698