Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Unified Diff: net/cert/cert_verify_proc.cc

Issue 267913003: net: reject all CloudFlare certificates issued prior to April 2nd. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698