OLD | NEW |
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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 static SHA256HashValue CalculateCAFingerprint256( | 418 static SHA256HashValue CalculateCAFingerprint256( |
419 const OSCertHandles& intermediates); | 419 const OSCertHandles& intermediates); |
420 | 420 |
421 // Calculates the SHA-256 fingerprint for the complete chain, including the | 421 // Calculates the SHA-256 fingerprint for the complete chain, including the |
422 // leaf certificate and all intermediate CA certificates. Returns an empty | 422 // leaf certificate and all intermediate CA certificates. Returns an empty |
423 // (all zero) fingerprint on failure. | 423 // (all zero) fingerprint on failure. |
424 static SHA256HashValue CalculateChainFingerprint256( | 424 static SHA256HashValue CalculateChainFingerprint256( |
425 OSCertHandle leaf, | 425 OSCertHandle leaf, |
426 const OSCertHandles& intermediates); | 426 const OSCertHandles& intermediates); |
427 | 427 |
| 428 // Returns true if the certificate is self-signed. |
| 429 static bool IsSelfSigned(OSCertHandle cert_handle); |
| 430 |
428 private: | 431 private: |
429 friend class base::RefCountedThreadSafe<X509Certificate>; | 432 friend class base::RefCountedThreadSafe<X509Certificate>; |
430 friend class TestRootCerts; // For unit tests | 433 friend class TestRootCerts; // For unit tests |
431 | 434 |
432 FRIEND_TEST_ALL_PREFIXES(X509CertificateNameVerifyTest, VerifyHostname); | 435 FRIEND_TEST_ALL_PREFIXES(X509CertificateNameVerifyTest, VerifyHostname); |
433 FRIEND_TEST_ALL_PREFIXES(X509CertificateTest, SerialNumbers); | 436 FRIEND_TEST_ALL_PREFIXES(X509CertificateTest, SerialNumbers); |
434 | 437 |
435 // Construct an X509Certificate from a handle to the certificate object | 438 // Construct an X509Certificate from a handle to the certificate object |
436 // in the underlying crypto library. | 439 // in the underlying crypto library. |
437 X509Certificate(OSCertHandle cert_handle, | 440 X509Certificate(OSCertHandle cert_handle, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 // based on the type of the certificate. | 517 // based on the type of the certificate. |
515 std::string default_nickname_; | 518 std::string default_nickname_; |
516 #endif | 519 #endif |
517 | 520 |
518 DISALLOW_COPY_AND_ASSIGN(X509Certificate); | 521 DISALLOW_COPY_AND_ASSIGN(X509Certificate); |
519 }; | 522 }; |
520 | 523 |
521 } // namespace net | 524 } // namespace net |
522 | 525 |
523 #endif // NET_CERT_X509_CERTIFICATE_H_ | 526 #endif // NET_CERT_X509_CERTIFICATE_H_ |
OLD | NEW |