OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SESSION_CACHE_OPENSSL_H | 5 #ifndef NET_SOCKET_SSL_SESSION_CACHE_OPENSSL_H |
6 #define NET_SOCKET_SSL_SESSION_CACHE_OPENSSL_H | 6 #define NET_SOCKET_SSL_SESSION_CACHE_OPENSSL_H |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // ensure that the value of |cache_key| matches the result of calling the | 106 // ensure that the value of |cache_key| matches the result of calling the |
107 // configuration's |key_func| function with the |ssl| as parameter. | 107 // configuration's |key_func| function with the |ssl| as parameter. |
108 // | 108 // |
109 // Every |check_expiration_count| call to either SetSSLSession() or | 109 // Every |check_expiration_count| call to either SetSSLSession() or |
110 // SetSSLSessionWithKey() triggers a check for, and removal of, expired | 110 // SetSSLSessionWithKey() triggers a check for, and removal of, expired |
111 // sessions. | 111 // sessions. |
112 // | 112 // |
113 // Return true iff a cached session was associated with the |ssl| connection. | 113 // Return true iff a cached session was associated with the |ssl| connection. |
114 bool SetSSLSessionWithKey(SSL* ssl, const std::string& cache_key); | 114 bool SetSSLSessionWithKey(SSL* ssl, const std::string& cache_key); |
115 | 115 |
116 // Return true iff a cached session was associated with the given |cache_key|. | |
117 bool SSLSessionIsInCache(const std::string& cache_key) const; | |
118 | |
119 // Indicates that the SSL session associated with |ssl| is "good" - that is, | 116 // Indicates that the SSL session associated with |ssl| is "good" - that is, |
120 // that all associated cryptographic parameters that were negotiated, | 117 // that all associated cryptographic parameters that were negotiated, |
121 // including the peer's certificate, were successfully validated. Because | 118 // including the peer's certificate, were successfully validated. Because |
122 // OpenSSL does not provide an asynchronous certificate verification | 119 // OpenSSL does not provide an asynchronous certificate verification |
123 // callback, it's necessary to manually manage the sessions to ensure that | 120 // callback, it's necessary to manually manage the sessions to ensure that |
124 // only validated sessions are resumed. | 121 // only validated sessions are resumed. |
125 void MarkSSLSessionAsGood(SSL* ssl); | 122 void MarkSSLSessionAsGood(SSL* ssl); |
126 | 123 |
127 // Flush removes all entries from the cache. This is typically called when | 124 // Flush removes all entries from the cache. This is typically called when |
128 // the system's certificate store has changed. | 125 // the system's certificate store has changed. |
129 void Flush(); | 126 void Flush(); |
130 | 127 |
131 // TODO(digit): Move to client code. | 128 // TODO(digit): Move to client code. |
132 static const int kDefaultTimeoutSeconds = 60 * 60; | 129 static const int kDefaultTimeoutSeconds = 60 * 60; |
133 static const size_t kMaxEntries = 1024; | 130 static const size_t kMaxEntries = 1024; |
134 static const size_t kMaxExpirationChecks = 256; | 131 static const size_t kMaxExpirationChecks = 256; |
135 | 132 |
136 private: | 133 private: |
137 DISALLOW_COPY_AND_ASSIGN(SSLSessionCacheOpenSSL); | 134 DISALLOW_COPY_AND_ASSIGN(SSLSessionCacheOpenSSL); |
138 | 135 |
139 SSLSessionCacheOpenSSLImpl* impl_; | 136 SSLSessionCacheOpenSSLImpl* impl_; |
140 }; | 137 }; |
141 | 138 |
142 } // namespace net | 139 } // namespace net |
143 | 140 |
144 #endif // NET_SOCKET_SSL_SESSION_CACHE_OPENSSL_H | 141 #endif // NET_SOCKET_SSL_SESSION_CACHE_OPENSSL_H |
OLD | NEW |