Chromium Code Reviews| Index: ios/web/navigation/crw_session_certificate_policy_manager.mm |
| diff --git a/ios/web/navigation/crw_session_certificate_policy_manager.mm b/ios/web/navigation/crw_session_certificate_policy_manager.mm |
| index 5be4bae8bc40e9646c290accbd925faaec6c451a..ecab91d0e298a5d38db9ce5a86ec0932208b332f 100644 |
| --- a/ios/web/navigation/crw_session_certificate_policy_manager.mm |
| +++ b/ios/web/navigation/crw_session_certificate_policy_manager.mm |
| @@ -13,6 +13,7 @@ |
| #include "base/strings/sys_string_conversions.h" |
| #include "ios/web/public/certificate_policy_cache.h" |
| #include "ios/web/public/web_thread.h" |
| +#include "net/base/hash_value.h" |
| #include "net/cert/x509_certificate.h" |
| // Break if we detect that CertStatus values changed, because we persist them on |
| @@ -50,6 +51,7 @@ NSString* const kAllowedCertificatesKey = @"allowedCertificates"; |
| struct AllowedCertificate { |
| scoped_refptr<net::X509Certificate> certificate; |
| + net::SHA256HashValue certificateHash; |
| std::string host; |
| }; |
| @@ -59,10 +61,10 @@ class LessThan { |
| const AllowedCertificate& rhs) const { |
| if (lhs.host != rhs.host) |
| return lhs.host < rhs.host; |
| - return certificateCompare_(lhs.certificate, rhs.certificate); |
| + return hashCompare_(lhs.certificateHash, rhs.certificateHash); |
|
eroman
2016/06/09 23:16:17
Why is it that we don't just have an operator<() o
|
| } |
| private: |
| - net::X509Certificate::LessThan certificateCompare_; |
| + const net::SHA256HashValueLessThan hashCompare_; |
| }; |
| typedef std::map<AllowedCertificate, net::CertStatus, LessThan> |
| @@ -105,7 +107,10 @@ void AddToCertificatePolicyCache( |
| status:(net::CertStatus)status { |
| DCHECK([NSThread isMainThread]); |
| DCHECK(certificate); |
| - AllowedCertificate allowedCertificate = {certificate, host}; |
| + AllowedCertificate allowedCertificate = { |
| + certificate, host, net::X509Certificate::CalculateChainFingerprint256( |
| + certificate->os_cert_handle(), |
| + certificate->GetIntermediateCertificates())}; |
| allowed_[allowedCertificate] = status; |
| } |