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

Side by Side Diff: net/base/cert_verifier.h

Issue 8342054: net: enable CRL sets behind a command line flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « net/base/cert_database_nss_unittest.cc ('k') | net/base/cert_verifier.cc » ('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 #ifndef NET_BASE_CERT_VERIFIER_H_ 5 #ifndef NET_BASE_CERT_VERIFIER_H_
6 #define NET_BASE_CERT_VERIFIER_H_ 6 #define NET_BASE_CERT_VERIFIER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/threading/non_thread_safe.h" 14 #include "base/threading/non_thread_safe.h"
15 #include "base/time.h" 15 #include "base/time.h"
16 #include "net/base/cert_database.h" 16 #include "net/base/cert_database.h"
17 #include "net/base/cert_verify_result.h" 17 #include "net/base/cert_verify_result.h"
18 #include "net/base/completion_callback.h" 18 #include "net/base/completion_callback.h"
19 #include "net/base/net_export.h" 19 #include "net/base/net_export.h"
20 #include "net/base/x509_cert_types.h" 20 #include "net/base/x509_cert_types.h"
21 21
22 namespace net { 22 namespace net {
23 23
24 class BoundNetLog; 24 class BoundNetLog;
25 class CertVerifierJob; 25 class CertVerifierJob;
26 class CertVerifierWorker; 26 class CertVerifierWorker;
27 class CRLSet;
27 class X509Certificate; 28 class X509Certificate;
28 29
29 // CachedCertVerifyResult contains the result of a certificate verification. 30 // CachedCertVerifyResult contains the result of a certificate verification.
30 struct CachedCertVerifyResult { 31 struct CachedCertVerifyResult {
31 CachedCertVerifyResult(); 32 CachedCertVerifyResult();
32 ~CachedCertVerifyResult(); 33 ~CachedCertVerifyResult();
33 34
34 // Returns true if |current_time| is greater than or equal to |expiry|. 35 // Returns true if |current_time| is greater than or equal to |expiry|.
35 bool HasExpired(base::Time current_time) const; 36 bool HasExpired(base::Time current_time) const;
36 37
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // 86 //
86 // |flags| is bitwise OR'd of X509Certificate::VerifyFlags. 87 // |flags| is bitwise OR'd of X509Certificate::VerifyFlags.
87 // If VERIFY_REV_CHECKING_ENABLED is set in |flags|, certificate revocation 88 // If VERIFY_REV_CHECKING_ENABLED is set in |flags|, certificate revocation
88 // checking is performed. 89 // checking is performed.
89 // 90 //
90 // If VERIFY_EV_CERT is set in |flags| too, EV certificate verification is 91 // If VERIFY_EV_CERT is set in |flags| too, EV certificate verification is
91 // performed. If |flags| is VERIFY_EV_CERT (that is, 92 // performed. If |flags| is VERIFY_EV_CERT (that is,
92 // VERIFY_REV_CHECKING_ENABLED is not set), EV certificate verification will 93 // VERIFY_REV_CHECKING_ENABLED is not set), EV certificate verification will
93 // not be performed. 94 // not be performed.
94 // 95 //
96 // |crl_set| points to an optional CRLSet structure which can be used to
97 // avoid revocation checks over the network.
98 //
95 // |callback| must not be null. ERR_IO_PENDING is returned if the operation 99 // |callback| must not be null. ERR_IO_PENDING is returned if the operation
96 // could not be completed synchronously, in which case the result code will 100 // could not be completed synchronously, in which case the result code will
97 // be passed to the callback when available. 101 // be passed to the callback when available.
98 // 102 //
99 // If |out_req| is non-NULL, then |*out_req| will be filled with a handle to 103 // If |out_req| is non-NULL, then |*out_req| will be filled with a handle to
100 // the async request. This handle is not valid after the request has 104 // the async request. This handle is not valid after the request has
101 // completed. 105 // completed.
102 int Verify(X509Certificate* cert, 106 int Verify(X509Certificate* cert,
103 const std::string& hostname, 107 const std::string& hostname,
104 int flags, 108 int flags,
109 CRLSet* crl_set,
105 CertVerifyResult* verify_result, 110 CertVerifyResult* verify_result,
106 const CompletionCallback& callback, 111 const CompletionCallback& callback,
107 RequestHandle* out_req, 112 RequestHandle* out_req,
108 const BoundNetLog& net_log); 113 const BoundNetLog& net_log);
109 114
110 // Cancels the specified request. |req| is the handle returned by Verify(). 115 // Cancels the specified request. |req| is the handle returned by Verify().
111 // After a request is canceled, its completion callback will not be called. 116 // After a request is canceled, its completion callback will not be called.
112 void CancelRequest(RequestHandle req); 117 void CancelRequest(RequestHandle req);
113 118
114 // Clears the verification result cache. 119 // Clears the verification result cache.
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 // If a completion callback is pending when the verifier is destroyed, the 200 // If a completion callback is pending when the verifier is destroyed, the
196 // certificate verification is canceled, and the completion callback will 201 // certificate verification is canceled, and the completion callback will
197 // not be called. 202 // not be called.
198 ~SingleRequestCertVerifier(); 203 ~SingleRequestCertVerifier();
199 204
200 // Verifies the given certificate, filling out the |verify_result| object 205 // Verifies the given certificate, filling out the |verify_result| object
201 // upon success. See CertVerifier::Verify() for details. 206 // upon success. See CertVerifier::Verify() for details.
202 int Verify(X509Certificate* cert, 207 int Verify(X509Certificate* cert,
203 const std::string& hostname, 208 const std::string& hostname,
204 int flags, 209 int flags,
210 CRLSet* crl_set,
205 CertVerifyResult* verify_result, 211 CertVerifyResult* verify_result,
206 const CompletionCallback& callback, 212 const CompletionCallback& callback,
207 const BoundNetLog& net_log); 213 const BoundNetLog& net_log);
208 214
209 private: 215 private:
210 // Callback for when the request to |cert_verifier_| completes, so we 216 // Callback for when the request to |cert_verifier_| completes, so we
211 // dispatch to the user's callback. 217 // dispatch to the user's callback.
212 void OnVerifyCompletion(int result); 218 void OnVerifyCompletion(int result);
213 219
214 // The actual certificate verifier that will handle the request. 220 // The actual certificate verifier that will handle the request.
215 CertVerifier* const cert_verifier_; 221 CertVerifier* const cert_verifier_;
216 222
217 // The current request (if any). 223 // The current request (if any).
218 CertVerifier::RequestHandle cur_request_; 224 CertVerifier::RequestHandle cur_request_;
219 CompletionCallback cur_request_callback_; 225 CompletionCallback cur_request_callback_;
220 226
221 DISALLOW_COPY_AND_ASSIGN(SingleRequestCertVerifier); 227 DISALLOW_COPY_AND_ASSIGN(SingleRequestCertVerifier);
222 }; 228 };
223 229
224 } // namespace net 230 } // namespace net
225 231
226 #endif // NET_BASE_CERT_VERIFIER_H_ 232 #endif // NET_BASE_CERT_VERIFIER_H_
OLDNEW
« no previous file with comments | « net/base/cert_database_nss_unittest.cc ('k') | net/base/cert_verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698