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

Side by Side Diff: net/cert/cert_verify_proc.cc

Issue 508823009: Mark SHA-1 as deprecated (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cert_verify_result_sha1
Patch Set: Created 6 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/cert/cert_verify_proc.h" 5 #include "net/cert/cert_verify_proc.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/sha1.h" 9 #include "base/sha1.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 // Flag certificates using weak signature algorithms. 255 // Flag certificates using weak signature algorithms.
256 if (verify_result->has_md5) { 256 if (verify_result->has_md5) {
257 verify_result->cert_status |= CERT_STATUS_WEAK_SIGNATURE_ALGORITHM; 257 verify_result->cert_status |= CERT_STATUS_WEAK_SIGNATURE_ALGORITHM;
258 // Avoid replacing a more serious error, such as an OS/library failure, 258 // Avoid replacing a more serious error, such as an OS/library failure,
259 // by ensuring that if verification failed, it failed with a certificate 259 // by ensuring that if verification failed, it failed with a certificate
260 // error. 260 // error.
261 if (rv == OK || IsCertificateError(rv)) 261 if (rv == OK || IsCertificateError(rv))
262 rv = MapCertStatusToNetError(verify_result->cert_status); 262 rv = MapCertStatusToNetError(verify_result->cert_status);
263 } 263 }
264 264
265 // The date to begin warning about SHA-1 deprecation
266 // 2016-01-01 00:00:00 UTC
267 static const int64_t kSHA1DeprecationDate = INT64_C(13096080000000000);
268 if (verify_result->has_sha1 &&
269 verify_result->verified_cert->valid_expiry() >
270 base::Time::FromInternalValue(kSHA1DeprecationDate)) {
271 // The leaf certificate has a validity period beyond the (soft) SHA-1
272 // sunset date of 2016/1/1 and the (hard) SHA-1 sunset date of 2017/1/1,
273 // and SHA-1 appears in the chain. As such, flag it as deprecated.
274 //
275 // Note: Only the leaf validity period is checked, as it's expected that
276 // nearly all intermediates will exceed the 2016/2017 validity range. The
277 // purpose of this check is to discourage NEW SHA-1 certificates, which is
278 // why it's only necessary to check the leaf.
279 verify_result->cert_status |= CERT_STATUS_DEPRECATED_SIGNATURE_ALGORITHM;
280 }
281
265 // Flag certificates from publicly-trusted CAs that are issued to intranet 282 // Flag certificates from publicly-trusted CAs that are issued to intranet
266 // hosts. While the CA/Browser Forum Baseline Requirements (v1.1) permit 283 // hosts. While the CA/Browser Forum Baseline Requirements (v1.1) permit
267 // these to be issued until 1 November 2015, they represent a real risk for 284 // these to be issued until 1 November 2015, they represent a real risk for
268 // the deployment of gTLDs and are being phased out ahead of the hard 285 // the deployment of gTLDs and are being phased out ahead of the hard
269 // deadline. 286 // deadline.
270 if (verify_result->is_issued_by_known_root && IsHostnameNonUnique(hostname)) { 287 if (verify_result->is_issued_by_known_root && IsHostnameNonUnique(hostname)) {
271 verify_result->cert_status |= CERT_STATUS_NON_UNIQUE_NAME; 288 verify_result->cert_status |= CERT_STATUS_NON_UNIQUE_NAME;
272 // CERT_STATUS_NON_UNIQUE_NAME will eventually become a hard error. For 289 // CERT_STATUS_NON_UNIQUE_NAME will eventually become a hard error. For
273 // now treat it as a warning and do not map it to an error return value. 290 // now treat it as a warning and do not map it to an error return value.
274 } 291 }
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 return true; 619 return true;
603 } 620 }
604 } 621 }
605 } 622 }
606 } 623 }
607 624
608 return false; 625 return false;
609 } 626 }
610 627
611 } // namespace net 628 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698