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

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

Issue 717653002: Revert "Reject certificates that are valid for too long." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « net/base/net_error_list.h ('k') | net/cert/cert_status_flags_list.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_status_flags.h" 5 #include "net/cert/cert_status_flags.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "net/base/net_errors.h" 8 #include "net/base/net_errors.h"
9 9
10 namespace net { 10 namespace net {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 case ERR_CERT_WEAK_SIGNATURE_ALGORITHM: 42 case ERR_CERT_WEAK_SIGNATURE_ALGORITHM:
43 return CERT_STATUS_WEAK_SIGNATURE_ALGORITHM; 43 return CERT_STATUS_WEAK_SIGNATURE_ALGORITHM;
44 case ERR_CERT_NON_UNIQUE_NAME: 44 case ERR_CERT_NON_UNIQUE_NAME:
45 return CERT_STATUS_NON_UNIQUE_NAME; 45 return CERT_STATUS_NON_UNIQUE_NAME;
46 case ERR_CERT_WEAK_KEY: 46 case ERR_CERT_WEAK_KEY:
47 return CERT_STATUS_WEAK_KEY; 47 return CERT_STATUS_WEAK_KEY;
48 case ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN: 48 case ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN:
49 return CERT_STATUS_PINNED_KEY_MISSING; 49 return CERT_STATUS_PINNED_KEY_MISSING;
50 case ERR_CERT_NAME_CONSTRAINT_VIOLATION: 50 case ERR_CERT_NAME_CONSTRAINT_VIOLATION:
51 return CERT_STATUS_NAME_CONSTRAINT_VIOLATION; 51 return CERT_STATUS_NAME_CONSTRAINT_VIOLATION;
52 case ERR_CERT_VALIDITY_TOO_LONG:
53 return CERT_STATUS_VALIDITY_TOO_LONG;
54 default: 52 default:
55 return 0; 53 return 0;
56 } 54 }
57 } 55 }
58 56
59 int MapCertStatusToNetError(CertStatus cert_status) { 57 int MapCertStatusToNetError(CertStatus cert_status) {
60 // A certificate may have multiple errors. We report the most 58 // A certificate may have multiple errors. We report the most
61 // serious error. 59 // serious error.
62 60
63 // Unrecoverable errors 61 // Unrecoverable errors
(...skipping 12 matching lines...) Expand all
76 // CERT_STATUS_NON_UNIQUE_NAME is intentionally not mapped to an error. 74 // CERT_STATUS_NON_UNIQUE_NAME is intentionally not mapped to an error.
77 // It is treated as just a warning and used to degrade the SSL UI. 75 // It is treated as just a warning and used to degrade the SSL UI.
78 if (cert_status & CERT_STATUS_NAME_CONSTRAINT_VIOLATION) 76 if (cert_status & CERT_STATUS_NAME_CONSTRAINT_VIOLATION)
79 return ERR_CERT_NAME_CONSTRAINT_VIOLATION; 77 return ERR_CERT_NAME_CONSTRAINT_VIOLATION;
80 if (cert_status & CERT_STATUS_WEAK_SIGNATURE_ALGORITHM) 78 if (cert_status & CERT_STATUS_WEAK_SIGNATURE_ALGORITHM)
81 return ERR_CERT_WEAK_SIGNATURE_ALGORITHM; 79 return ERR_CERT_WEAK_SIGNATURE_ALGORITHM;
82 if (cert_status & CERT_STATUS_WEAK_KEY) 80 if (cert_status & CERT_STATUS_WEAK_KEY)
83 return ERR_CERT_WEAK_KEY; 81 return ERR_CERT_WEAK_KEY;
84 if (cert_status & CERT_STATUS_DATE_INVALID) 82 if (cert_status & CERT_STATUS_DATE_INVALID)
85 return ERR_CERT_DATE_INVALID; 83 return ERR_CERT_DATE_INVALID;
86 if (cert_status & CERT_STATUS_VALIDITY_TOO_LONG)
87 return ERR_CERT_VALIDITY_TOO_LONG;
88 84
89 // Unknown status. Give it the benefit of the doubt. 85 // Unknown status. Give it the benefit of the doubt.
90 if (cert_status & CERT_STATUS_UNABLE_TO_CHECK_REVOCATION) 86 if (cert_status & CERT_STATUS_UNABLE_TO_CHECK_REVOCATION)
91 return ERR_CERT_UNABLE_TO_CHECK_REVOCATION; 87 return ERR_CERT_UNABLE_TO_CHECK_REVOCATION;
92 if (cert_status & CERT_STATUS_NO_REVOCATION_MECHANISM) 88 if (cert_status & CERT_STATUS_NO_REVOCATION_MECHANISM)
93 return ERR_CERT_NO_REVOCATION_MECHANISM; 89 return ERR_CERT_NO_REVOCATION_MECHANISM;
94 90
95 NOTREACHED(); 91 NOTREACHED();
96 return ERR_UNEXPECTED; 92 return ERR_UNEXPECTED;
97 } 93 }
98 94
99 } // namespace net 95 } // namespace net
OLDNEW
« no previous file with comments | « net/base/net_error_list.h ('k') | net/cert/cert_status_flags_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698