OpenSSLSessionContext (Apache Tomcat 10.1.57 API Documentation)
Description: declaration: package: org.apache.tomcat.util.net.openssl, class: OpenSSLSessionContext

# Class OpenSSLSessionContext

java.lang.Object
org.apache.tomcat.util.net.openssl.OpenSSLSessionContext

All Implemented Interfaces:
  `SSLSessionContext`

public class OpenSSLSessionContext extends Object implements SSLSessionContext
OpenSSL specific `SSLSessionContext` implementation.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Enumeration<byte[]>`
  `getIds()`
  `SSLSession`
  `getSession(byte[] bytes)`
  `int`
  `getSessionCacheSize()`
  `int`
  `getSessionTimeout()`
  `boolean`
  `isSessionCacheEnabled()`
  Checks if caching of SSL sessions is enabled.
  `void`
  `setSessionCacheEnabled(boolean enabled)`
  Enable or disable caching of SSL sessions.
  `void`
  `setSessionCacheSize(int size)`
  `boolean`
  `setSessionIdContext(byte[] sidCtx)`
  Set the context within which session be reused (server side only) See man SSL_CTX_set_session_id_context
  `void`
  `setSessionTimeout(int seconds)`
  `void`
  `setTicketKeys(byte[] keys)`
  Sets the SSL session ticket keys of this context.
  `OpenSSLSessionStats`
  `stats()`
  Returns the statistics for this context.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### getSession

    public SSLSession getSession(byte[] bytes)
    Specified by:
      `getSession` in interface `SSLSessionContext`

  - ### getIds

    public Enumeration<byte[]> getIds()
    Specified by:
      `getIds` in interface `SSLSessionContext`

  - ### setTicketKeys

    public void setTicketKeys(byte[] keys)
    Sets the SSL session ticket keys of this context.
    Parameters:
      `keys` - The session ticket keys

  - ### setSessionCacheEnabled

    public void setSessionCacheEnabled(boolean enabled)
    Enable or disable caching of SSL sessions.
    Parameters:
      `enabled` - `true` to enable caching, `false` to disable

  - ### isSessionCacheEnabled

    public boolean isSessionCacheEnabled()
    Checks if caching of SSL sessions is enabled.
    Returns:
      true if caching of SSL sessions is enabled

  - ### stats

    public OpenSSLSessionStats stats()
    Returns the statistics for this context.
    Returns:
      The session statistics

  - ### setSessionTimeout

    public void setSessionTimeout(int seconds)
    Specified by:
      `setSessionTimeout` in interface `SSLSessionContext`

  - ### getSessionTimeout

    public int getSessionTimeout()
    Specified by:
      `getSessionTimeout` in interface `SSLSessionContext`

  - ### setSessionCacheSize

    public void setSessionCacheSize(int size)
    Specified by:
      `setSessionCacheSize` in interface `SSLSessionContext`

  - ### getSessionCacheSize

    public int getSessionCacheSize()
    Specified by:
      `getSessionCacheSize` in interface `SSLSessionContext`

  - ### setSessionIdContext

    public boolean setSessionIdContext(byte[] sidCtx)
    Set the context within which session be reused (server side only) See man SSL_CTX_set_session_id_context
    Parameters:
      `sidCtx` - can be any kind of binary data, it is therefore possible to use e.g. the name of the application and/or the hostname and/or service name
    Returns:
      `true` if success, `false` otherwise.