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

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

Issue 1115903002: Refactor the API for CertVerifier::Verify() and the implementation of MultiThreadedCertVerifier::Ver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again Created 5 years, 7 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
« no previous file with comments | « google_apis/gcm/tools/mcs_probe.cc ('k') | net/cert/mock_cert_verifier.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) 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_VERIFIER_H_ 5 #ifndef NET_CERT_CERT_VERIFIER_H_
6 #define NET_CERT_CERT_VERIFIER_H_ 6 #define NET_CERT_CERT_VERIFIER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "net/base/completion_callback.h" 11 #include "net/base/completion_callback.h"
12 #include "net/base/net_export.h" 12 #include "net/base/net_export.h"
13 13
14 namespace net { 14 namespace net {
15 15
16 class BoundNetLog; 16 class BoundNetLog;
17 class CertVerifyResult; 17 class CertVerifyResult;
18 class CRLSet; 18 class CRLSet;
19 class X509Certificate; 19 class X509Certificate;
20 20
21 // CertVerifier represents a service for verifying certificates. 21 // CertVerifier represents a service for verifying certificates.
22 // 22 //
23 // CertVerifiers can handle multiple requests at a time. A simpler alternative 23 // CertVerifiers can handle multiple requests at a time.
24 // for consumers that only have 1 outstanding request at a time is to create a
25 // SingleRequestCertVerifier wrapper around CertVerifier (which will
26 // automatically cancel the single request when it goes out of scope).
27 class NET_EXPORT CertVerifier { 24 class NET_EXPORT CertVerifier {
28 public: 25 public:
29 // Opaque pointer type used to cancel outstanding requests. 26 class Request {
pneubeck (no reviews) 2015/05/13 10:13:07 another thing that I stumbled over: it's not docu
pneubeck (no reviews) 2015/05/13 12:01:20 and, since the copy is not allowed anymore, I find
30 typedef void* RequestHandle; 27 public:
28 // Destruction of the Request cancels it.
29 virtual ~Request() {}
30 };
31 31
32 enum VerifyFlags { 32 enum VerifyFlags {
33 // If set, enables online revocation checking via CRLs and OCSP for the 33 // If set, enables online revocation checking via CRLs and OCSP for the
34 // certificate chain. 34 // certificate chain.
35 VERIFY_REV_CHECKING_ENABLED = 1 << 0, 35 VERIFY_REV_CHECKING_ENABLED = 1 << 0,
36 36
37 // If set, and the certificate being verified may be an EV certificate, 37 // If set, and the certificate being verified may be an EV certificate,
38 // attempt to verify the certificate according to the EV processing 38 // attempt to verify the certificate according to the EV processing
39 // guidelines. In order to successfully verify a certificate as EV, 39 // guidelines. In order to successfully verify a certificate as EV,
40 // either an online or offline revocation check must be successfully 40 // either an online or offline revocation check must be successfully
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // VERIFY_REV_CHECKING_ENABLED is not set), EV certificate verification will 92 // VERIFY_REV_CHECKING_ENABLED is not set), EV certificate verification will
93 // not be performed. 93 // not be performed.
94 // 94 //
95 // |crl_set| points to an optional CRLSet structure which can be used to 95 // |crl_set| points to an optional CRLSet structure which can be used to
96 // avoid revocation checks over the network. 96 // avoid revocation checks over the network.
97 // 97 //
98 // |callback| must not be null. ERR_IO_PENDING is returned if the operation 98 // |callback| must not be null. ERR_IO_PENDING is returned if the operation
99 // could not be completed synchronously, in which case the result code will 99 // could not be completed synchronously, in which case the result code will
100 // be passed to the callback when available. 100 // be passed to the callback when available.
101 // 101 //
102 // |*out_req| will be filled with a handle to the async request. 102 // |*out_req| will be filled with a pointer to the asynchronous request.
pneubeck (no reviews) 2015/05/12 09:20:16 It seems that it is not guaranteed that out_req wi
eroman 2015/05/12 14:22:11 Thanks Phillip! I will address that in a follow-up
103 // This handle is not valid after the request has completed. 103 // Freeing this pointer before the request has completed will cancel it.
104 // 104 //
105 // TODO(rsleevi): Move CRLSet* out of the CertVerifier signature. 105 // TODO(rsleevi): Move CRLSet* out of the CertVerifier signature.
106 virtual int Verify(X509Certificate* cert, 106 virtual int Verify(X509Certificate* cert,
107 const std::string& hostname, 107 const std::string& hostname,
108 const std::string& ocsp_response, 108 const std::string& ocsp_response,
109 int flags, 109 int flags,
110 CRLSet* crl_set, 110 CRLSet* crl_set,
111 CertVerifyResult* verify_result, 111 CertVerifyResult* verify_result,
112 const CompletionCallback& callback, 112 const CompletionCallback& callback,
113 RequestHandle* out_req, 113 scoped_ptr<Request>* out_req,
114 const BoundNetLog& net_log) = 0; 114 const BoundNetLog& net_log) = 0;
115 115
116 // Cancels the specified request. |req| is the handle returned by Verify().
117 // After a request is canceled, its completion callback will not be called.
118 virtual void CancelRequest(RequestHandle req) = 0;
119
120 // Returns true if this CertVerifier supports stapled OCSP responses. 116 // Returns true if this CertVerifier supports stapled OCSP responses.
121 virtual bool SupportsOCSPStapling(); 117 virtual bool SupportsOCSPStapling();
122 118
123 // Creates a CertVerifier implementation that verifies certificates using 119 // Creates a CertVerifier implementation that verifies certificates using
124 // the preferred underlying cryptographic libraries. 120 // the preferred underlying cryptographic libraries.
125 static CertVerifier* CreateDefault(); 121 static CertVerifier* CreateDefault();
126 }; 122 };
127 123
128 } // namespace net 124 } // namespace net
129 125
130 #endif // NET_CERT_CERT_VERIFIER_H_ 126 #endif // NET_CERT_CERT_VERIFIER_H_
OLDNEW
« no previous file with comments | « google_apis/gcm/tools/mcs_probe.cc ('k') | net/cert/mock_cert_verifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698