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 #ifndef NET_CERT_CERT_VERIFY_PROC_H_ | 5 #ifndef NET_CERT_CERT_VERIFY_PROC_H_ |
6 #define NET_CERT_CERT_VERIFY_PROC_H_ | 6 #define NET_CERT_CERT_VERIFY_PROC_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/feature_list.h" | 11 #include "base/feature_list.h" |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "net/base/net_export.h" | 15 #include "net/base/net_export.h" |
16 #include "net/cert/x509_cert_types.h" | 16 #include "net/cert/x509_cert_types.h" |
17 #include "net/cert/x509_certificate.h" | |
18 | 17 |
19 namespace net { | 18 namespace net { |
20 | 19 |
21 class CertVerifyResult; | 20 class CertVerifyResult; |
22 class CRLSet; | 21 class CRLSet; |
23 class X509Certificate; | 22 class X509Certificate; |
24 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; | 23 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; |
25 | 24 |
26 // Class to perform certificate path building and verification for various | 25 // Class to perform certificate path building and verification for various |
27 // certificate uses. All methods of this class must be thread-safe, as they | 26 // certificate uses. All methods of this class must be thread-safe, as they |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 FRIEND_TEST_ALL_PREFIXES(CertVerifyProcTest, DigiNotarCerts); | 85 FRIEND_TEST_ALL_PREFIXES(CertVerifyProcTest, DigiNotarCerts); |
87 FRIEND_TEST_ALL_PREFIXES(CertVerifyProcTest, TestHasTooLongValidity); | 86 FRIEND_TEST_ALL_PREFIXES(CertVerifyProcTest, TestHasTooLongValidity); |
88 FRIEND_TEST_ALL_PREFIXES(CertVerifyProcTest, | 87 FRIEND_TEST_ALL_PREFIXES(CertVerifyProcTest, |
89 VerifyRejectsSHA1AfterDeprecationLegacyMode); | 88 VerifyRejectsSHA1AfterDeprecationLegacyMode); |
90 | 89 |
91 // Performs the actual verification using the desired underlying | 90 // Performs the actual verification using the desired underlying |
92 // | 91 // |
93 // On entry, |verify_result| will be default-initialized as a successful | 92 // On entry, |verify_result| will be default-initialized as a successful |
94 // validation, with |verify_result->verified_cert| set to |cert|. | 93 // validation, with |verify_result->verified_cert| set to |cert|. |
95 // | 94 // |
96 // Implementations are expected to fill in all applicable fields, excluding | 95 // Implementations are expected to fill in all applicable fields, excluding: |
97 // |ocsp_result|, which will be filled in by |Verify()|. If an error code is | 96 // |
98 // returned, |verify_result->cert_status| should be non-zero, indicating an | 97 // * ocsp_result |
| 98 // * has_md2 |
| 99 // * has_md4 |
| 100 // * has_md5 |
| 101 // * has_sha1 |
| 102 // * has_sha1_leaf |
| 103 // |
| 104 // which will be filled in by |Verify()|. If an error code is returned, |
| 105 // |verify_result->cert_status| should be non-zero, indicating an |
99 // error occurred. | 106 // error occurred. |
100 // | 107 // |
101 // On success, net::OK should be returned, with |verify_result| updated to | 108 // On success, net::OK should be returned, with |verify_result| updated to |
102 // reflect the successfully verified chain. | 109 // reflect the successfully verified chain. |
103 virtual int VerifyInternal(X509Certificate* cert, | 110 virtual int VerifyInternal(X509Certificate* cert, |
104 const std::string& hostname, | 111 const std::string& hostname, |
105 const std::string& ocsp_response, | 112 const std::string& ocsp_response, |
106 int flags, | 113 int flags, |
107 CRLSet* crl_set, | 114 CRLSet* crl_set, |
108 const CertificateList& additional_trust_anchors, | 115 const CertificateList& additional_trust_anchors, |
(...skipping 27 matching lines...) Expand all Loading... |
136 // (i.e. by 1 July 2019). | 143 // (i.e. by 1 July 2019). |
137 static bool HasTooLongValidity(const X509Certificate& cert); | 144 static bool HasTooLongValidity(const X509Certificate& cert); |
138 | 145 |
139 // Emergency kill-switch for SHA-1 deprecation. Disabled by default. | 146 // Emergency kill-switch for SHA-1 deprecation. Disabled by default. |
140 static const base::Feature kSHA1LegacyMode; | 147 static const base::Feature kSHA1LegacyMode; |
141 const bool sha1_legacy_mode_enabled; | 148 const bool sha1_legacy_mode_enabled; |
142 | 149 |
143 DISALLOW_COPY_AND_ASSIGN(CertVerifyProc); | 150 DISALLOW_COPY_AND_ASSIGN(CertVerifyProc); |
144 }; | 151 }; |
145 | 152 |
146 // Sets the weak signature hash fields of |verify_result| to true if | |
147 // applicable for |cert|, otherwise does not modify them. | |
148 // | |
149 // The fields in question are: |has_md2|, |has_md4|, |has_md5|,|has_sha1| and | |
150 // |has_sha1_leaf|. | |
151 // | |
152 // Returns the hash algorithm that was determined for |cert|. | |
153 // | |
154 // This function is intended to be used as a helper by platform-specific | |
155 // CertVerifyProc implementations. | |
156 X509Certificate::SignatureHashAlgorithm FillCertVerifyResultWeakSignature( | |
157 X509Certificate::OSCertHandle cert, | |
158 bool is_leaf, | |
159 CertVerifyResult* verify_result); | |
160 | |
161 } // namespace net | 153 } // namespace net |
162 | 154 |
163 #endif // NET_CERT_CERT_VERIFY_PROC_H_ | 155 #endif // NET_CERT_CERT_VERIFY_PROC_H_ |
OLD | NEW |