iaik.security.ssl
Class SessionManager

java.lang.Object
  extended by iaik.security.ssl.SessionManager
Direct Known Subclasses:
DefaultSessionManager

public abstract class SessionManager
extends java.lang.Object

An abstract parent class of all SessionManagers. A SessionManager keeps track of session ids and associated session parameters to allow for a faster SSL handshake.

This class also stores the system's default session manager.

See Also:
DefaultSessionManager, Session

Field Summary
protected  int cacheSizeLimit
          Maxiumum size of the session cache (default: 0 so that there is no limit).
 
Constructor Summary
protected SessionManager()
          Constructor for use by subclasses.
 
Method Summary
protected abstract  void cacheSession(SSLTransport transport, Session session)
          Add this session to the session cache.
 int getCacheSizeLimit()
          Gets the size limit of the session cache.
static SessionManager getDefault()
          Get the current session manager.
 long getResumePeriod()
          Returns the resume period of this session manager.
protected abstract  Session getSession(SSLTransport transport, java.lang.Object sessionID)
          Get a session from the session cache.
 void setCacheSizeLimit(int size)
          Sets the size limit of the session cache.
static void setDefault(SessionManager manager)
          Set the session manager.
 void setNumberOfTicketsToBeSent(int n)
          Sets the number of tickets to be sent to the client.
 void setResumePeriod(long period)
          Sets the resume period of cached sessions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cacheSizeLimit

protected int cacheSizeLimit
Maxiumum size of the session cache (default: 0 so that there is no limit).

Constructor Detail

SessionManager

protected SessionManager()
Constructor for use by subclasses.

Method Detail

getDefault

public static SessionManager getDefault()
Get the current session manager. Null if session caching is disabled, Initially set to an instance of DefaultSessionManager.

Returns:
the current session manager

setDefault

public static void setDefault(SessionManager manager)
Set the session manager. Set to null to disable session caching for all SSLContexts created after (!) this call.


cacheSession

protected abstract void cacheSession(SSLTransport transport,
                                     Session session)
Add this session to the session cache.

Parameters:
session - the session to cache
transport - the transport

getSession

protected abstract Session getSession(SSLTransport transport,
                                      java.lang.Object sessionID)
Get a session from the session cache.

Parameters:
transport - the transport
sessionID - a SessionID or null
Returns:
null if the session is not in the cache or the SessionManager wont resume this session; the cached session otherwise

setCacheSizeLimit

public void setCacheSizeLimit(int size)
                       throws java.lang.IllegalArgumentException
Sets the size limit of the session cache.

Parameters:
size - the size limit of the session cache; a size of 0 indicates that the session cache size has no limit
Throws:
java.lang.IllegalArgumentException - if the given size is < 0.

getCacheSizeLimit

public int getCacheSizeLimit()
Gets the size limit of the session cache.

Returns:
the size limit of the session cache; a size of 0 indicates that the session cache size has no limit

setResumePeriod

public void setResumePeriod(long period)
Sets the resume period of cached sessions. After this time a session is removed from the session cache and therefore cann't be resumed. If the SSLSocket connects again to this host he has to renegotiate the security parameters.

Parameters:
period - the resume period in seconds

getResumePeriod

public long getResumePeriod()
Returns the resume period of this session manager.

Returns:
the resume period in seconds

setNumberOfTicketsToBeSent

public void setNumberOfTicketsToBeSent(int n)
Sets the number of tickets to be sent to the client.

Only meaningful for TLS 1.3 and on the server side.

In TLS 1.3, after having successfully established a session the server can send one or more NewSessionTicket messages to client. Each NewSessionTicket message contains a ticket the client may use to later indicate a session it wants to resume. With this method the number of tickets (and therefore NewSessionTicket) messages can be configured that a TLS 1.3 server shall send to the client. Each NewSessionTicket message will contain a new ticket but will refer to the same base session to may be resumed later on.

Parameters:
n - the number of tickets to be sent to the client (default: 1).

This Javadoc may contain text parts from text parts from IETF Internet Standard specifications (see copyright note).

iSaSiLk 6.0, (c) 2002 IAIK, (c) 2003 - 2015 SIC