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 #include "net/cert/x509_certificate.h" | 5 #include "net/cert/x509_certificate.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 } | 492 } |
493 | 493 |
494 bool X509Certificate::HasExpired() const { | 494 bool X509Certificate::HasExpired() const { |
495 return base::Time::Now() > valid_expiry(); | 495 return base::Time::Now() > valid_expiry(); |
496 } | 496 } |
497 | 497 |
498 bool X509Certificate::Equals(const X509Certificate* other) const { | 498 bool X509Certificate::Equals(const X509Certificate* other) const { |
499 return IsSameOSCert(cert_handle_, other->cert_handle_); | 499 return IsSameOSCert(cert_handle_, other->cert_handle_); |
500 } | 500 } |
501 | 501 |
| 502 void X509Certificate::GetCertificateChain(OSCertHandles* cert_chain) const { |
| 503 cert_chain->clear(); |
| 504 cert_chain->push_back(cert_handle_); |
| 505 cert_chain->insert(cert_chain->end(), |
| 506 intermediate_ca_certs_.begin(), |
| 507 intermediate_ca_certs_.end()); |
| 508 } |
| 509 |
502 // static | 510 // static |
503 bool X509Certificate::VerifyHostname( | 511 bool X509Certificate::VerifyHostname( |
504 const std::string& hostname, | 512 const std::string& hostname, |
505 const std::string& cert_common_name, | 513 const std::string& cert_common_name, |
506 const std::vector<std::string>& cert_san_dns_names, | 514 const std::vector<std::string>& cert_san_dns_names, |
507 const std::vector<std::string>& cert_san_ip_addrs, | 515 const std::vector<std::string>& cert_san_ip_addrs, |
508 bool* common_name_fallback_used) { | 516 bool* common_name_fallback_used) { |
509 DCHECK(!hostname.empty()); | 517 DCHECK(!hostname.empty()); |
510 // Perform name verification following http://tools.ietf.org/html/rfc6125. | 518 // Perform name verification following http://tools.ietf.org/html/rfc6125. |
511 // The terminology used in this method is as per that RFC:- | 519 // The terminology used in this method is as per that RFC:- |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 RemoveFromCache(cert_handle_); | 735 RemoveFromCache(cert_handle_); |
728 FreeOSCertHandle(cert_handle_); | 736 FreeOSCertHandle(cert_handle_); |
729 } | 737 } |
730 for (size_t i = 0; i < intermediate_ca_certs_.size(); ++i) { | 738 for (size_t i = 0; i < intermediate_ca_certs_.size(); ++i) { |
731 RemoveFromCache(intermediate_ca_certs_[i]); | 739 RemoveFromCache(intermediate_ca_certs_[i]); |
732 FreeOSCertHandle(intermediate_ca_certs_[i]); | 740 FreeOSCertHandle(intermediate_ca_certs_[i]); |
733 } | 741 } |
734 } | 742 } |
735 | 743 |
736 } // namespace net | 744 } // namespace net |
OLD | NEW |