Index: net/cert/cert_verify_proc.cc |
diff --git a/net/cert/cert_verify_proc.cc b/net/cert/cert_verify_proc.cc |
index df7054072ab12f19c209f15190e5034049afe13e..4dd7560683413ba8db9213bb7dec1e1bb7e00213 100644 |
--- a/net/cert/cert_verify_proc.cc |
+++ b/net/cert/cert_verify_proc.cc |
@@ -4,6 +4,7 @@ |
#include "net/cert/cert_verify_proc.h" |
+#include "base/basictypes.h" |
#include "base/metrics/histogram.h" |
#include "base/sha1.h" |
#include "base/strings/stringprintf.h" |
@@ -341,6 +342,25 @@ bool CertVerifyProc::IsBlacklisted(X509Certificate* cert) { |
} |
} |
+ // CloudFlare revoked all certificates issued prior to April 2nd, 2014. Thus |
+ // all certificates where the CN ends with ".cloudflare.com" with a prior |
+ // issuance date are rejected. |
+ // |
+ // The old certs had a lifetime of five years, so this can be removed April |
+ // 2nd, 2019. |
+ const std::string& cn = cert->subject().common_name; |
+ static const char kCloudFlareCNSuffix[] = ".cloudflare.com"; |
+ // kCloudFlareEpoch is the base::Time internal value for midnight at the |
+ // beginning of April 2nd, 2014, UTC. |
+ static const int64 kCloudFlareEpoch = INT64_C(13040870400000000); |
+ if (cn.size() > arraysize(kCloudFlareCNSuffix) - 1 && |
+ cn.compare(cn.size() - (arraysize(kCloudFlareCNSuffix) - 1), |
+ arraysize(kCloudFlareCNSuffix) - 1, |
+ kCloudFlareCNSuffix) == 0 && |
+ cert->valid_start() < base::Time::FromInternalValue(kCloudFlareEpoch)) { |
+ return true; |
+ } |
+ |
return false; |
} |