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

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
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // |callback| must not be null. ERR_IO_PENDING is returned if the operation 96 // |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 97 // could not be completed synchronously, in which case the result code will
97 // be passed to the callback when available. 98 // be passed to the callback when available.
98 // 99 //
99 // If |out_req| is non-NULL, then |*out_req| will be filled with a handle to 100 // 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 101 // the async request. This handle is not valid after the request has
101 // completed. 102 // completed.
102 int Verify(X509Certificate* cert, 103 int Verify(X509Certificate* cert,
103 const std::string& hostname, 104 const std::string& hostname,
104 int flags, 105 int flags,
106 CRLSet* crl_set,
wtc 2011/10/21 23:17:31 Please document the new |crl_set| parameter. You
agl 2011/10/24 20:44:27 Done.
105 CertVerifyResult* verify_result, 107 CertVerifyResult* verify_result,
106 const CompletionCallback& callback, 108 const CompletionCallback& callback,
107 RequestHandle* out_req, 109 RequestHandle* out_req,
108 const BoundNetLog& net_log); 110 const BoundNetLog& net_log);
109 111
110 // Cancels the specified request. |req| is the handle returned by Verify(). 112 // Cancels the specified request. |req| is the handle returned by Verify().
111 // After a request is canceled, its completion callback will not be called. 113 // After a request is canceled, its completion callback will not be called.
112 void CancelRequest(RequestHandle req); 114 void CancelRequest(RequestHandle req);
113 115
114 // Clears the verification result cache. 116 // 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 197 // If a completion callback is pending when the verifier is destroyed, the
196 // certificate verification is canceled, and the completion callback will 198 // certificate verification is canceled, and the completion callback will
197 // not be called. 199 // not be called.
198 ~SingleRequestCertVerifier(); 200 ~SingleRequestCertVerifier();
199 201
200 // Verifies the given certificate, filling out the |verify_result| object 202 // Verifies the given certificate, filling out the |verify_result| object
201 // upon success. See CertVerifier::Verify() for details. 203 // upon success. See CertVerifier::Verify() for details.
202 int Verify(X509Certificate* cert, 204 int Verify(X509Certificate* cert,
203 const std::string& hostname, 205 const std::string& hostname,
204 int flags, 206 int flags,
207 CRLSet* crl_set,
205 CertVerifyResult* verify_result, 208 CertVerifyResult* verify_result,
206 const CompletionCallback& callback, 209 const CompletionCallback& callback,
207 const BoundNetLog& net_log); 210 const BoundNetLog& net_log);
208 211
209 private: 212 private:
210 // Callback for when the request to |cert_verifier_| completes, so we 213 // Callback for when the request to |cert_verifier_| completes, so we
211 // dispatch to the user's callback. 214 // dispatch to the user's callback.
212 void OnVerifyCompletion(int result); 215 void OnVerifyCompletion(int result);
213 216
214 // The actual certificate verifier that will handle the request. 217 // The actual certificate verifier that will handle the request.
215 CertVerifier* const cert_verifier_; 218 CertVerifier* const cert_verifier_;
216 219
217 // The current request (if any). 220 // The current request (if any).
218 CertVerifier::RequestHandle cur_request_; 221 CertVerifier::RequestHandle cur_request_;
219 CompletionCallback cur_request_callback_; 222 CompletionCallback cur_request_callback_;
220 223
221 DISALLOW_COPY_AND_ASSIGN(SingleRequestCertVerifier); 224 DISALLOW_COPY_AND_ASSIGN(SingleRequestCertVerifier);
222 }; 225 };
223 226
224 } // namespace net 227 } // namespace net
225 228
226 #endif // NET_BASE_CERT_VERIFIER_H_ 229 #endif // NET_BASE_CERT_VERIFIER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698