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..0f15ce0a54864524625cb0c4b2f3494f8ae4a3dc 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); |
| } |
| private: |
| - net::X509Certificate::LessThan certificateCompare_; |
| + net::SHA256HashValueLessThan hashCompare_; |
|
Eugene But (OOO till 7-30)
2016/06/16 01:14:34
Optional NIT: Since you touching this could you pl
Ryan Sleevi
2016/06/16 01:19:44
Happy to. This file seemed to follow obj-C naming
Eugene But (OOO till 7-30)
2016/06/16 01:36:23
This was a mix of C++ and Obj-C. In Obj-C leading
|
| }; |
| typedef std::map<AllowedCertificate, net::CertStatus, LessThan> |
| @@ -105,7 +107,11 @@ void AddToCertificatePolicyCache( |
| status:(net::CertStatus)status { |
| DCHECK([NSThread isMainThread]); |
| DCHECK(certificate); |
| - AllowedCertificate allowedCertificate = {certificate, host}; |
| + AllowedCertificate allowedCertificate = { |
| + certificate, net::X509Certificate::CalculateChainFingerprint256( |
| + certificate->os_cert_handle(), |
| + certificate->GetIntermediateCertificates()), |
| + host}; |
| allowed_[allowedCertificate] = status; |
| } |