| 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_CERT_CERT_VERIFY_PROC_H_ | 5 #ifndef NET_CERT_CERT_VERIFY_PROC_H_ |
| 6 #define NET_CERT_CERT_VERIFY_PROC_H_ | 6 #define NET_CERT_CERT_VERIFY_PROC_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 // Verifies the certificate against the given hostname as an SSL server | 32 // Verifies the certificate against the given hostname as an SSL server |
| 33 // certificate. Returns OK if successful or an error code upon failure. | 33 // certificate. Returns OK if successful or an error code upon failure. |
| 34 // | 34 // |
| 35 // The |*verify_result| structure, including the |verify_result->cert_status| | 35 // The |*verify_result| structure, including the |verify_result->cert_status| |
| 36 // bitmask, is always filled out regardless of the return value. If the | 36 // bitmask, is always filled out regardless of the return value. If the |
| 37 // certificate has multiple errors, the corresponding status flags are set in | 37 // certificate has multiple errors, the corresponding status flags are set in |
| 38 // |verify_result->cert_status|, and the error code for the most serious | 38 // |verify_result->cert_status|, and the error code for the most serious |
| 39 // error is returned. | 39 // error is returned. |
| 40 // | 40 // |
| 41 // |ocsp_response|, if non-empty, is a stapled OCSP response to use. |
| 42 // |
| 41 // |flags| is bitwise OR'd of VerifyFlags: | 43 // |flags| is bitwise OR'd of VerifyFlags: |
| 42 // | 44 // |
| 43 // If VERIFY_REV_CHECKING_ENABLED is set in |flags|, online certificate | 45 // If VERIFY_REV_CHECKING_ENABLED is set in |flags|, online certificate |
| 44 // revocation checking is performed (i.e. OCSP and downloading CRLs). CRLSet | 46 // revocation checking is performed (i.e. OCSP and downloading CRLs). CRLSet |
| 45 // based revocation checking is always enabled, regardless of this flag, if | 47 // based revocation checking is always enabled, regardless of this flag, if |
| 46 // |crl_set| is given. | 48 // |crl_set| is given. |
| 47 // | 49 // |
| 48 // If VERIFY_EV_CERT is set in |flags| too, EV certificate verification is | 50 // If VERIFY_EV_CERT is set in |flags| too, EV certificate verification is |
| 49 // performed. | 51 // performed. |
| 50 // | 52 // |
| 51 // |crl_set| points to an optional CRLSet structure which can be used to | 53 // |crl_set| points to an optional CRLSet structure which can be used to |
| 52 // avoid revocation checks over the network. | 54 // avoid revocation checks over the network. |
| 53 // | 55 // |
| 54 // |additional_trust_anchors| lists certificates that can be trusted when | 56 // |additional_trust_anchors| lists certificates that can be trusted when |
| 55 // building a certificate chain, in addition to the anchors known to the | 57 // building a certificate chain, in addition to the anchors known to the |
| 56 // implementation. | 58 // implementation. |
| 57 int Verify(X509Certificate* cert, | 59 int Verify(X509Certificate* cert, |
| 58 const std::string& hostname, | 60 const std::string& hostname, |
| 61 const std::string& ocsp_response, |
| 59 int flags, | 62 int flags, |
| 60 CRLSet* crl_set, | 63 CRLSet* crl_set, |
| 61 const CertificateList& additional_trust_anchors, | 64 const CertificateList& additional_trust_anchors, |
| 62 CertVerifyResult* verify_result); | 65 CertVerifyResult* verify_result); |
| 63 | 66 |
| 64 // Returns true if the implementation supports passing additional trust | 67 // Returns true if the implementation supports passing additional trust |
| 65 // anchors to the Verify() call. The |additional_trust_anchors| parameter | 68 // anchors to the Verify() call. The |additional_trust_anchors| parameter |
| 66 // passed to Verify() is ignored when this returns false. | 69 // passed to Verify() is ignored when this returns false. |
| 67 virtual bool SupportsAdditionalTrustAnchors() const = 0; | 70 virtual bool SupportsAdditionalTrustAnchors() const = 0; |
| 68 | 71 |
| 72 // Returns true if the implementation supports passing a stapled OCSP response |
| 73 // to the Verify() call. The |ocsp_response| parameter passed to Verify() is |
| 74 // ignored when this returns false. |
| 75 virtual bool SupportsOCSPStapling() const = 0; |
| 76 |
| 69 protected: | 77 protected: |
| 70 CertVerifyProc(); | 78 CertVerifyProc(); |
| 71 virtual ~CertVerifyProc(); | 79 virtual ~CertVerifyProc(); |
| 72 | 80 |
| 73 private: | 81 private: |
| 74 friend class base::RefCountedThreadSafe<CertVerifyProc>; | 82 friend class base::RefCountedThreadSafe<CertVerifyProc>; |
| 75 FRIEND_TEST_ALL_PREFIXES(CertVerifyProcTest, DigiNotarCerts); | 83 FRIEND_TEST_ALL_PREFIXES(CertVerifyProcTest, DigiNotarCerts); |
| 76 FRIEND_TEST_ALL_PREFIXES(CertVerifyProcTest, TestHasTooLongValidity); | 84 FRIEND_TEST_ALL_PREFIXES(CertVerifyProcTest, TestHasTooLongValidity); |
| 77 | 85 |
| 78 // Performs the actual verification using the desired underlying | 86 // Performs the actual verification using the desired underlying |
| 79 // cryptographic library. | 87 // cryptographic library. |
| 80 virtual int VerifyInternal(X509Certificate* cert, | 88 virtual int VerifyInternal(X509Certificate* cert, |
| 81 const std::string& hostname, | 89 const std::string& hostname, |
| 90 const std::string& ocsp_response, |
| 82 int flags, | 91 int flags, |
| 83 CRLSet* crl_set, | 92 CRLSet* crl_set, |
| 84 const CertificateList& additional_trust_anchors, | 93 const CertificateList& additional_trust_anchors, |
| 85 CertVerifyResult* verify_result) = 0; | 94 CertVerifyResult* verify_result) = 0; |
| 86 | 95 |
| 87 // Returns true if |cert| is explicitly blacklisted. | 96 // Returns true if |cert| is explicitly blacklisted. |
| 88 static bool IsBlacklisted(X509Certificate* cert); | 97 static bool IsBlacklisted(X509Certificate* cert); |
| 89 | 98 |
| 90 // IsPublicKeyBlacklisted returns true iff one of |public_key_hashes| (which | 99 // IsPublicKeyBlacklisted returns true iff one of |public_key_hashes| (which |
| 91 // are hashes of SubjectPublicKeyInfo structures) is explicitly blocked. | 100 // are hashes of SubjectPublicKeyInfo structures) is explicitly blocked. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 111 // requirement they expire within 7 years after the effective date of the BRs | 120 // requirement they expire within 7 years after the effective date of the BRs |
| 112 // (i.e. by 1 July 2019). | 121 // (i.e. by 1 July 2019). |
| 113 static bool HasTooLongValidity(const X509Certificate& cert); | 122 static bool HasTooLongValidity(const X509Certificate& cert); |
| 114 | 123 |
| 115 DISALLOW_COPY_AND_ASSIGN(CertVerifyProc); | 124 DISALLOW_COPY_AND_ASSIGN(CertVerifyProc); |
| 116 }; | 125 }; |
| 117 | 126 |
| 118 } // namespace net | 127 } // namespace net |
| 119 | 128 |
| 120 #endif // NET_CERT_CERT_VERIFY_PROC_H_ | 129 #endif // NET_CERT_CERT_VERIFY_PROC_H_ |
| OLD | NEW |