OLD | NEW |
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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 } | 119 } |
120 | 120 |
121 // Returns true if |cert| contains a known-weak key. Additionally, histograms | 121 // Returns true if |cert| contains a known-weak key. Additionally, histograms |
122 // the observed keys for future tightening of the definition of what | 122 // the observed keys for future tightening of the definition of what |
123 // constitutes a weak key. | 123 // constitutes a weak key. |
124 bool ExaminePublicKeys(const scoped_refptr<X509Certificate>& cert, | 124 bool ExaminePublicKeys(const scoped_refptr<X509Certificate>& cert, |
125 bool should_histogram) { | 125 bool should_histogram) { |
126 // The effective date of the CA/Browser Forum's Baseline Requirements - | 126 // The effective date of the CA/Browser Forum's Baseline Requirements - |
127 // 2012-07-01 00:00:00 UTC. | 127 // 2012-07-01 00:00:00 UTC. |
128 const base::Time kBaselineEffectiveDate = | 128 const base::Time kBaselineEffectiveDate = |
129 base::Time::FromInternalValue(GG_INT64_C(12985574400000000)); | 129 base::Time::FromInternalValue(INT64_C(12985574400000000)); |
130 // The effective date of the key size requirements from Appendix A, v1.1.5 | 130 // The effective date of the key size requirements from Appendix A, v1.1.5 |
131 // 2014-01-01 00:00:00 UTC. | 131 // 2014-01-01 00:00:00 UTC. |
132 const base::Time kBaselineKeysizeEffectiveDate = | 132 const base::Time kBaselineKeysizeEffectiveDate = |
133 base::Time::FromInternalValue(GG_INT64_C(13033008000000000)); | 133 base::Time::FromInternalValue(INT64_C(13033008000000000)); |
134 | 134 |
135 size_t size_bits = 0; | 135 size_t size_bits = 0; |
136 X509Certificate::PublicKeyType type = X509Certificate::kPublicKeyTypeUnknown; | 136 X509Certificate::PublicKeyType type = X509Certificate::kPublicKeyTypeUnknown; |
137 bool weak_key = false; | 137 bool weak_key = false; |
138 bool baseline_keysize_applies = | 138 bool baseline_keysize_applies = |
139 cert->valid_start() >= kBaselineEffectiveDate && | 139 cert->valid_start() >= kBaselineEffectiveDate && |
140 cert->valid_expiry() >= kBaselineKeysizeEffectiveDate; | 140 cert->valid_expiry() >= kBaselineKeysizeEffectiveDate; |
141 | 141 |
142 X509Certificate::GetPublicKeyInfo(cert->os_cert_handle(), &size_bits, &type); | 142 X509Certificate::GetPublicKeyInfo(cert->os_cert_handle(), &size_bits, &type); |
143 if (should_histogram) { | 143 if (should_histogram) { |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 return true; | 671 return true; |
672 | 672 |
673 // For certificates issued after 1 April 2015: 39 months. | 673 // For certificates issued after 1 April 2015: 39 months. |
674 if (start >= time_2015_04_01 && month_diff > 39) | 674 if (start >= time_2015_04_01 && month_diff > 39) |
675 return true; | 675 return true; |
676 | 676 |
677 return false; | 677 return false; |
678 } | 678 } |
679 | 679 |
680 } // namespace net | 680 } // namespace net |
OLD | NEW |