Index: ios/web/net/cert_host_pair.cc |
diff --git a/ios/web/net/cert_host_pair.cc b/ios/web/net/cert_host_pair.cc |
index 569a77b734275f382713f3abdb3870c376b3305e..9a47dbd75e85b0d0494155b6c9632e12c5dd6b54 100644 |
--- a/ios/web/net/cert_host_pair.cc |
+++ b/ios/web/net/cert_host_pair.cc |
@@ -8,18 +8,22 @@ |
namespace web { |
-CertHostPair::CertHostPair(const scoped_refptr<net::X509Certificate>& cert, |
- const std::string& host) |
- : cert(cert), host(host) {} |
+CertHostPair::CertHostPair(scoped_refptr<net::X509Certificate> cert, |
+ std::string host) |
+ : cert_(std::move(cert)), |
+ host_(std::move(host)), |
+ cert_hash_(net::X509Certificate::CalculateChainFingerprint256( |
+ cert_->os_cert_handle(), |
+ cert_->GetIntermediateCertificates())) {} |
CertHostPair::CertHostPair(const CertHostPair& other) = default; |
CertHostPair::~CertHostPair() {} |
bool CertHostPair::operator<(const CertHostPair& other) const { |
- if (host != other.host) |
- return host < other.host; |
- return net::X509Certificate::LessThan()(cert, other.cert); |
+ if (host_ != other.host_) |
+ return host_ < other.host_; |
+ return net::SHA256HashValueLessThan()(cert_hash_, other.cert_hash_); |
} |
} // web |