| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_SOCKET_SSL_HOST_INFO_H | 5 #ifndef NET_SOCKET_SSL_HOST_INFO_H |
| 6 #define NET_SOCKET_SSL_HOST_INFO_H | 6 #define NET_SOCKET_SSL_HOST_INFO_H |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/ref_counted.h" | 11 #include "base/ref_counted.h" |
| 12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
| 13 #include "base/time.h" |
| 13 #include "net/base/cert_verify_result.h" | 14 #include "net/base/cert_verify_result.h" |
| 14 #include "net/base/completion_callback.h" | 15 #include "net/base/completion_callback.h" |
| 15 #include "net/socket/ssl_client_socket.h" | 16 #include "net/socket/ssl_client_socket.h" |
| 16 | 17 |
| 17 namespace net { | 18 namespace net { |
| 18 | 19 |
| 19 class CertVerifier; | 20 class CertVerifier; |
| 20 class X509Certificate; | 21 class X509Certificate; |
| 21 struct SSLConfig; | 22 struct SSLConfig; |
| 22 | 23 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // the certificate. | 83 // the certificate. |
| 83 const CertVerifyResult& cert_verify_result() const; | 84 const CertVerifyResult& cert_verify_result() const; |
| 84 | 85 |
| 85 // WaitForCertVerification returns ERR_IO_PENDING if the certificate chain in | 86 // WaitForCertVerification returns ERR_IO_PENDING if the certificate chain in |
| 86 // |state().certs| is still being validated and arranges for the given | 87 // |state().certs| is still being validated and arranges for the given |
| 87 // callback to be called when the verification completes. If the verification
has | 88 // callback to be called when the verification completes. If the verification
has |
| 88 // already finished then WaitForCertVerification returns the result of that | 89 // already finished then WaitForCertVerification returns the result of that |
| 89 // verification. | 90 // verification. |
| 90 int WaitForCertVerification(CompletionCallback* callback); | 91 int WaitForCertVerification(CompletionCallback* callback); |
| 91 | 92 |
| 93 base::TimeTicks verification_start_time() const { |
| 94 return verification_start_time_; |
| 95 } |
| 96 |
| 92 protected: | 97 protected: |
| 93 // Parse parses an opaque blob of data and fills out the public member fields | 98 // Parse parses an opaque blob of data and fills out the public member fields |
| 94 // of this object. It returns true iff the parse was successful. The public | 99 // of this object. It returns true iff the parse was successful. The public |
| 95 // member fields will be set to something sane in any case. | 100 // member fields will be set to something sane in any case. |
| 96 bool Parse(const std::string& data); | 101 bool Parse(const std::string& data); |
| 97 std::string Serialize() const; | 102 std::string Serialize() const; |
| 98 State state_; | 103 State state_; |
| 99 | 104 |
| 100 private: | 105 private: |
| 101 // This is the callback function which the CertVerifier calls via |callback_|. | 106 // This is the callback function which the CertVerifier calls via |callback_|. |
| 102 void VerifyCallback(int rv); | 107 void VerifyCallback(int rv); |
| 103 | 108 |
| 104 // This is the hostname that we'll validate the certificates against. | 109 // This is the hostname that we'll validate the certificates against. |
| 105 const std::string hostname_; | 110 const std::string hostname_; |
| 106 bool cert_verification_complete_; | 111 bool cert_verification_complete_; |
| 107 bool cert_parsing_failed_; | 112 bool cert_parsing_failed_; |
| 108 int cert_verification_result_; | 113 int cert_verification_result_; |
| 109 CompletionCallback* cert_verification_callback_; | 114 CompletionCallback* cert_verification_callback_; |
| 110 // These two members are taken from the SSLConfig. | 115 // These two members are taken from the SSLConfig. |
| 111 bool rev_checking_enabled_; | 116 bool rev_checking_enabled_; |
| 112 bool verify_ev_cert_; | 117 bool verify_ev_cert_; |
| 118 base::TimeTicks verification_start_time_; |
| 113 CertVerifyResult cert_verify_result_; | 119 CertVerifyResult cert_verify_result_; |
| 114 scoped_ptr<CertVerifier> verifier_; | 120 scoped_ptr<CertVerifier> verifier_; |
| 115 scoped_refptr<X509Certificate> cert_; | 121 scoped_refptr<X509Certificate> cert_; |
| 116 scoped_refptr<CancelableCompletionCallback<SSLHostInfo> > callback_; | 122 scoped_refptr<CancelableCompletionCallback<SSLHostInfo> > callback_; |
| 117 }; | 123 }; |
| 118 | 124 |
| 119 class SSLHostInfoFactory { | 125 class SSLHostInfoFactory { |
| 120 public: | 126 public: |
| 121 virtual ~SSLHostInfoFactory(); | 127 virtual ~SSLHostInfoFactory(); |
| 122 | 128 |
| 123 // GetForHost returns a fresh, allocated SSLHostInfo for the given hostname | 129 // GetForHost returns a fresh, allocated SSLHostInfo for the given hostname |
| 124 // or NULL on failure. | 130 // or NULL on failure. |
| 125 virtual SSLHostInfo* GetForHost(const std::string& hostname, | 131 virtual SSLHostInfo* GetForHost(const std::string& hostname, |
| 126 const SSLConfig& ssl_config) = 0; | 132 const SSLConfig& ssl_config) = 0; |
| 127 }; | 133 }; |
| 128 | 134 |
| 129 } // namespace net | 135 } // namespace net |
| 130 | 136 |
| 131 #endif // NET_SOCKET_SSL_HOST_INFO_H | 137 #endif // NET_SOCKET_SSL_HOST_INFO_H |
| OLD | NEW |