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

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

Issue 1131173005: Improve documentation of CertVerifier::Verify() regarding |out_req|. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix, and verify compiles 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 | « no previous file | no next file » | 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. 23 // CertVerifiers can handle multiple requests at a time.
24 class NET_EXPORT CertVerifier { 24 class NET_EXPORT CertVerifier {
25 public: 25 public:
26 class Request { 26 class Request {
27 public: 27 public:
28 Request() {}
29
28 // Destruction of the Request cancels it. 30 // Destruction of the Request cancels it.
29 virtual ~Request() {} 31 virtual ~Request() {}
32
33 private:
34 DISALLOW_COPY_AND_ASSIGN(Request);
30 }; 35 };
31 36
32 enum VerifyFlags { 37 enum VerifyFlags {
33 // If set, enables online revocation checking via CRLs and OCSP for the 38 // If set, enables online revocation checking via CRLs and OCSP for the
34 // certificate chain. 39 // certificate chain.
35 VERIFY_REV_CHECKING_ENABLED = 1 << 0, 40 VERIFY_REV_CHECKING_ENABLED = 1 << 0,
36 41
37 // If set, and the certificate being verified may be an EV certificate, 42 // If set, and the certificate being verified may be an EV certificate,
38 // attempt to verify the certificate according to the EV processing 43 // attempt to verify the certificate according to the EV processing
39 // guidelines. In order to successfully verify a certificate as EV, 44 // guidelines. In order to successfully verify a certificate as EV,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // VERIFY_REV_CHECKING_ENABLED is not set), EV certificate verification will 97 // VERIFY_REV_CHECKING_ENABLED is not set), EV certificate verification will
93 // not be performed. 98 // not be performed.
94 // 99 //
95 // |crl_set| points to an optional CRLSet structure which can be used to 100 // |crl_set| points to an optional CRLSet structure which can be used to
96 // avoid revocation checks over the network. 101 // avoid revocation checks over the network.
97 // 102 //
98 // |callback| must not be null. ERR_IO_PENDING is returned if the operation 103 // |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 104 // could not be completed synchronously, in which case the result code will
100 // be passed to the callback when available. 105 // be passed to the callback when available.
101 // 106 //
102 // |*out_req| will be filled with a pointer to the asynchronous request. 107 // On asynchronous completion (when Verify returns ERR_IO_PENDING) |out_req|
103 // Freeing this pointer before the request has completed will cancel it. 108 // will be reset with a pointer to the request. Freeing this pointer before
109 // the request has completed will cancel it.
110 //
111 // If Verify() completes synchronously then |out_req| *may* be reset to
112 // nullptr. However it is not guaranteed that all implementations will reset
113 // it in this case.
104 // 114 //
105 // TODO(rsleevi): Move CRLSet* out of the CertVerifier signature. 115 // TODO(rsleevi): Move CRLSet* out of the CertVerifier signature.
106 virtual int Verify(X509Certificate* cert, 116 virtual int Verify(X509Certificate* cert,
107 const std::string& hostname, 117 const std::string& hostname,
108 const std::string& ocsp_response, 118 const std::string& ocsp_response,
109 int flags, 119 int flags,
110 CRLSet* crl_set, 120 CRLSet* crl_set,
111 CertVerifyResult* verify_result, 121 CertVerifyResult* verify_result,
112 const CompletionCallback& callback, 122 const CompletionCallback& callback,
113 scoped_ptr<Request>* out_req, 123 scoped_ptr<Request>* out_req,
114 const BoundNetLog& net_log) = 0; 124 const BoundNetLog& net_log) = 0;
115 125
116 // Returns true if this CertVerifier supports stapled OCSP responses. 126 // Returns true if this CertVerifier supports stapled OCSP responses.
117 virtual bool SupportsOCSPStapling(); 127 virtual bool SupportsOCSPStapling();
118 128
119 // Creates a CertVerifier implementation that verifies certificates using 129 // Creates a CertVerifier implementation that verifies certificates using
120 // the preferred underlying cryptographic libraries. 130 // the preferred underlying cryptographic libraries.
121 static CertVerifier* CreateDefault(); 131 static CertVerifier* CreateDefault();
122 }; 132 };
123 133
124 } // namespace net 134 } // namespace net
125 135
126 #endif // NET_CERT_CERT_VERIFIER_H_ 136 #endif // NET_CERT_CERT_VERIFIER_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698