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 SessionIsInCache(const std::string& cache_key) const; | |
wtc
2014/06/17 17:44:41
Nit: add "SSL" before "Session" because the other
mshelley1
2014/06/18 18:53:51
Done.
| |
118 | |
116 // Indicates that the SSL session associated with |ssl| is "good" - that is, | 119 // Indicates that the SSL session associated with |ssl| is "good" - that is, |
117 // that all associated cryptographic parameters that were negotiated, | 120 // that all associated cryptographic parameters that were negotiated, |
118 // including the peer's certificate, were successfully validated. Because | 121 // including the peer's certificate, were successfully validated. Because |
119 // OpenSSL does not provide an asynchronous certificate verification | 122 // OpenSSL does not provide an asynchronous certificate verification |
120 // callback, it's necessary to manually manage the sessions to ensure that | 123 // callback, it's necessary to manually manage the sessions to ensure that |
121 // only validated sessions are resumed. | 124 // only validated sessions are resumed. |
122 void MarkSSLSessionAsGood(SSL* ssl); | 125 void MarkSSLSessionAsGood(SSL* ssl); |
123 | 126 |
124 // Flush removes all entries from the cache. This is typically called when | 127 // Flush removes all entries from the cache. This is typically called when |
125 // the system's certificate store has changed. | 128 // the system's certificate store has changed. |
126 void Flush(); | 129 void Flush(); |
127 | 130 |
128 // TODO(digit): Move to client code. | 131 // TODO(digit): Move to client code. |
129 static const int kDefaultTimeoutSeconds = 60 * 60; | 132 static const int kDefaultTimeoutSeconds = 60 * 60; |
130 static const size_t kMaxEntries = 1024; | 133 static const size_t kMaxEntries = 1024; |
131 static const size_t kMaxExpirationChecks = 256; | 134 static const size_t kMaxExpirationChecks = 256; |
132 | 135 |
133 private: | 136 private: |
134 DISALLOW_COPY_AND_ASSIGN(SSLSessionCacheOpenSSL); | 137 DISALLOW_COPY_AND_ASSIGN(SSLSessionCacheOpenSSL); |
135 | 138 |
136 SSLSessionCacheOpenSSLImpl* impl_; | 139 SSLSessionCacheOpenSSLImpl* impl_; |
137 }; | 140 }; |
138 | 141 |
139 } // namespace net | 142 } // namespace net |
140 | 143 |
141 #endif // NET_SOCKET_SSL_SESSION_CACHE_OPENSSL_H | 144 #endif // NET_SOCKET_SSL_SESSION_CACHE_OPENSSL_H |
OLD | NEW |