iaik.security.ssl
Class DefaultSessionManager

java.lang.Object
  extended by iaik.security.ssl.SessionManager
      extended by iaik.security.ssl.DefaultSessionManager

public class DefaultSessionManager
extends SessionManager

This class implements a simple Default SessionManager. Sessions are stored with the IP address of the peer as key. To get a session from the cache a SSL server calls getSession(addr, id) with the IP address of the client and the session id if the client wants to resume a previous session. If there is no session in the cache or if the cached session has a differend id this method returns null.

A SSL client calls this method with no session id (= null). If there already exists a session to this host the client tries to resume it.


Field Summary
 
Fields inherited from class iaik.security.ssl.SessionManager
cacheSizeLimit
 
Constructor Summary
DefaultSessionManager()
          Create only one sessin manager for all SSLSockets.
 
Method Summary
protected  void cacheSession(SSLTransport transport, Session session)
          Put a session into the session cache.
 void clear()
          Clears the contents of the SessionManager.
 int getCacheSizeLimit()
          Gets the size limit of the session cache.
 long getResumePeriod()
          Returns the resume period of this session manager.
protected  Session getSession(SSLTransport transport, java.lang.Object sessionID)
          Returns a session from the cache.
 void setCacheSizeLimit(int size)
          Sets the size limit of the session cache.
 void setResumePeriod(long period)
          Sets the resume period of cached sessions.
 java.lang.String toString()
          Returns some statistics about the sessions cache.
 
Methods inherited from class iaik.security.ssl.SessionManager
getDefault, setDefault
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultSessionManager

public DefaultSessionManager()
Create only one sessin manager for all SSLSockets.

Method Detail

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

cacheSession

protected void cacheSession(SSLTransport transport,
                            Session session)
Put a session into the session cache. For internal use.

Specified by:
cacheSession in class SessionManager
Parameters:
transport - the SSLTransport which wants to cache this session
session - the session to cache

getSession

protected Session getSession(SSLTransport transport,
                             java.lang.Object sessionID)
Returns a session from the cache. Old sessions are removed automatically. For internal use.

Specified by:
getSession in class SessionManager
Parameters:
transport - the SSLTransport which wants to look for a session
sessionID - the ID of the session which should be resumed or null if this method is called by a SSL client.
Returns:
the session from the cache or null

setCacheSizeLimit

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

Overrides:
setCacheSizeLimit in class SessionManager
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.

Overrides:
getCacheSizeLimit in class SessionManager
Returns:
the size limit of the session cache; a size of 0 indicates that the session cache size has no limit

clear

public void clear()
Clears the contents of the SessionManager.


toString

public java.lang.String toString()
Returns some statistics about the sessions cache.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of some statistics

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

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