SSLSession (Java SE 15 & JDK 15) (original) (raw)

All Known Implementing Classes:

[ExtendedSSLSession](ExtendedSSLSession.html "class in javax.net.ssl")


public interface SSLSession

In SSL, sessions are used to describe an ongoing relationship between two entities. Each SSL connection involves one session at a time, but that session may be used on many connections between those entities, simultaneously or sequentially. The session used on a connection may also be replaced by a different session. Sessions are created, or rejoined, as part of the SSL handshaking protocol. Sessions may be invalidated due to policies affecting security or resource usage, or by an application explicitly calling invalidate. Session management policies are typically used to tune performance.

In addition to the standard session attributes, SSL sessions expose these read-only attributes:

Sessions may be explicitly invalidated. Invalidation may also be done implicitly, when faced with certain kinds of errors.

Since:

1.4

Modifier and Type Method Description
int getApplicationBufferSize() Gets the current size of the largest application data that is expected when using this session.
String getCipherSuite() Returns the name of the SSL cipher suite which is used for all connections in the session.
long getCreationTime() Returns the time at which this Session representation was created, in milliseconds since midnight, January 1, 1970 UTC.
byte[] getId() Returns the identifier assigned to this Session.
long getLastAccessedTime() Returns the last time this Session representation was accessed by the session level infrastructure, in milliseconds since midnight, January 1, 1970 UTC.
Certificate[] getLocalCertificates() Returns the certificate(s) that were sent to the peer during handshaking.
Principal getLocalPrincipal() Returns the principal that was sent to the peer during handshaking.
int getPacketBufferSize() Gets the current size of the largest SSL/TLS/DTLS packet that is expected when using this session.
default X509Certificate[] getPeerCertificateChain() Deprecated, for removal: This API element is subject to removal in a future version.
Certificate[] getPeerCertificates() Returns the identity of the peer which was established as part of defining the session.
String getPeerHost() Returns the host name of the peer in this session.
int getPeerPort() Returns the port number of the peer in this session.
Principal getPeerPrincipal() Returns the identity of the peer which was established as part of defining the session.
String getProtocol() Returns the standard name of the protocol used for all connections in the session.
SSLSessionContext getSessionContext() Returns the context in which this session is bound.
Object getValue​(String name) Returns the object bound to the given name in the session's application layer data.
String[] getValueNames() Returns an array of the names of all the application layer data objects bound into the Session.
void invalidate() Invalidates the session.
boolean isValid() Returns whether this session is valid and available for resuming or joining.
void putValue​(String name,Object value) Binds the specified value object into the session's application layer data with the given name.
void removeValue​(String name) Removes the object bound to the given name in the session's application layer data.