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_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 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 // | 22 // |
23 // CertVerifiers can handle multiple requests at a time. A simpler alternative | 23 // CertVerifiers can handle multiple requests at a time. A simpler alternative |
24 // for consumers that only have 1 outstanding request at a time is to create a | 24 // for consumers that only have 1 outstanding request at a time is to create a |
25 // SingleRequestCertVerifier wrapper around CertVerifier (which will | 25 // SingleRequestCertVerifier wrapper around CertVerifier (which will |
26 // automatically cancel the single request when it goes out of scope). | 26 // automatically cancel the single request when it goes out of scope). |
27 class NET_EXPORT CertVerifier { | 27 class NET_EXPORT CertVerifier { |
28 public: | 28 public: |
29 // Opaque pointer type used to cancel outstanding requests. | 29 // Opaque pointer type used to cancel outstanding requests. |
30 typedef void* RequestHandle; | 30 typedef void* RequestHandle; |
31 | 31 |
| 32 enum VerifyFlags { |
| 33 VERIFY_REV_CHECKING_ENABLED = 1 << 0, |
| 34 VERIFY_EV_CERT = 1 << 1, |
| 35 VERIFY_CERT_IO_ENABLED = 1 << 2, |
| 36 }; |
| 37 |
32 // When the verifier is destroyed, all certificate verification requests are | 38 // When the verifier is destroyed, all certificate verification requests are |
33 // canceled, and their completion callbacks will not be called. | 39 // canceled, and their completion callbacks will not be called. |
34 virtual ~CertVerifier() {} | 40 virtual ~CertVerifier() {} |
35 | 41 |
36 // Verifies the given certificate against the given hostname as an SSL server. | 42 // Verifies the given certificate against the given hostname as an SSL server. |
37 // Returns OK if successful or an error code upon failure. | 43 // Returns OK if successful or an error code upon failure. |
38 // | 44 // |
39 // The |*verify_result| structure, including the |verify_result->cert_status| | 45 // The |*verify_result| structure, including the |verify_result->cert_status| |
40 // bitmask, is always filled out regardless of the return value. If the | 46 // bitmask, is always filled out regardless of the return value. If the |
41 // certificate has multiple errors, the corresponding status flags are set in | 47 // certificate has multiple errors, the corresponding status flags are set in |
42 // |verify_result->cert_status|, and the error code for the most serious | 48 // |verify_result->cert_status|, and the error code for the most serious |
43 // error is returned. | 49 // error is returned. |
44 // | 50 // |
45 // |flags| is bitwise OR'd of X509Certificate::VerifyFlags. | 51 // |flags| is bitwise OR'd of VerifyFlags. |
46 // If VERIFY_REV_CHECKING_ENABLED is set in |flags|, certificate revocation | 52 // If VERIFY_REV_CHECKING_ENABLED is set in |flags|, certificate revocation |
47 // checking is performed. | 53 // checking is performed. |
48 // | 54 // |
49 // If VERIFY_EV_CERT is set in |flags| too, EV certificate verification is | 55 // If VERIFY_EV_CERT is set in |flags| too, EV certificate verification is |
50 // performed. If |flags| is VERIFY_EV_CERT (that is, | 56 // performed. If |flags| is VERIFY_EV_CERT (that is, |
51 // VERIFY_REV_CHECKING_ENABLED is not set), EV certificate verification will | 57 // VERIFY_REV_CHECKING_ENABLED is not set), EV certificate verification will |
52 // not be performed. | 58 // not be performed. |
53 // | 59 // |
54 // |crl_set| points to an optional CRLSet structure which can be used to | 60 // |crl_set| points to an optional CRLSet structure which can be used to |
55 // avoid revocation checks over the network. | 61 // avoid revocation checks over the network. |
(...skipping 21 matching lines...) Expand all Loading... |
77 virtual void CancelRequest(RequestHandle req) = 0; | 83 virtual void CancelRequest(RequestHandle req) = 0; |
78 | 84 |
79 // Creates a CertVerifier implementation that verifies certificates using | 85 // Creates a CertVerifier implementation that verifies certificates using |
80 // the preferred underlying cryptographic libraries. | 86 // the preferred underlying cryptographic libraries. |
81 static CertVerifier* CreateDefault(); | 87 static CertVerifier* CreateDefault(); |
82 }; | 88 }; |
83 | 89 |
84 } // namespace net | 90 } // namespace net |
85 | 91 |
86 #endif // NET_BASE_CERT_VERIFIER_H_ | 92 #endif // NET_BASE_CERT_VERIFIER_H_ |
OLD | NEW |