Botan  1.11.15
src/lib/tls/sessions_sqlite3/tls_session_manager_sqlite.h
Go to the documentation of this file.
00001 /*
00002 * SQLite3 TLS Session Manager
00003 * (C) 2012 Jack Lloyd
00004 *
00005 * Botan is released under the Simplified BSD License (see license.txt)
00006 */
00007 
00008 #ifndef BOTAN_TLS_SQLITE3_SESSION_MANAGER_H__
00009 #define BOTAN_TLS_SQLITE3_SESSION_MANAGER_H__
00010 
00011 #include <botan/tls_session_manager_sql.h>
00012 #include <botan/rng.h>
00013 
00014 namespace Botan {
00015 
00016 namespace TLS {
00017 
00018 /**
00019 * An implementation of Session_Manager that saves values in a SQLite3
00020 * database file, with the session data encrypted using a passphrase.
00021 *
00022 * @warning For clients, the hostnames associated with the saved
00023 * sessions are stored in the database in plaintext. This may be a
00024 * serious privacy risk in some situations.
00025 */
00026 class BOTAN_DLL
00027 Session_Manager_SQLite : public Session_Manager_SQL
00028    {
00029    public:
00030       /**
00031       * @param passphrase used to encrypt the session data
00032       * @param rng a random number generator
00033       * @param db_filename filename of the SQLite database file.
00034                The table names tls_sessions and tls_sessions_metadata
00035                will be used
00036       * @param max_sessions a hint on the maximum number of sessions
00037       *        to keep in memory at any one time. (If zero, don't cap)
00038       * @param session_lifetime sessions are expired after this many
00039       *        seconds have elapsed from initial handshake.
00040       */
00041       Session_Manager_SQLite(const std::string& passphrase,
00042                              RandomNumberGenerator& rng,
00043                              const std::string& db_filename,
00044                              size_t max_sessions = 1000,
00045                              std::chrono::seconds session_lifetime = std::chrono::seconds(7200));
00046 };
00047 
00048 }
00049 
00050 }
00051 
00052 #endif