SSLSessionCache implementation for our native SSL implementation.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | OpenSslSessionCache.NativeSslSession
|
| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| private static final OpenSslSession[] | |
| private final OpenSslEngineMap | |
| private final AtomicInteger | |
| private int | |
| private final Map | |
| private final AtomicInteger |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv synchronized void | |
| pack-priv final synchronized boolean | containsSessionWithId(OpenSslSessionId id)
Returns |
| private void | |
| pack-priv final List | |
| public final long | getSession(long
{code SSL_CTX*} ssl, byte[] the session id sessionId)Implements io. SSL_SESSION should be retrieved for the given SSL and with the given session ID.
See SSL_CTX_sess_set_get_cb.
|
| pack-priv final synchronized OpenSslSession | |
| pack-priv final int | |
| pack-priv final int | |
| private void | |
| pack-priv final synchronized void | |
| protected boolean | Returns: true if the session should be cached, false otherwise.the new session. sessionCalled once a new |
| public boolean | sessionCreated(long
SSL*SSL_SESSION*Implements io. true if the cache takes ownership of the SSL_SESSION and will call SSL_SESSION_free once it should be destroyed,
false otherwise.
|
| protected void | sessionRemoved(OpenSslSessionCache.
the session to remove. sessionCalled once an |
| pack-priv boolean | |
| pack-priv final void | |
| pack-priv final void |
| DEFAULT_CACHE_SIZE | back to summary |
|---|---|
| private static final int DEFAULT_CACHE_SIZE | |
| EMPTY_SESSIONS | back to summary |
|---|---|
| private static final OpenSslSession[] EMPTY_SESSIONS | |
| engineMap | back to summary |
|---|---|
| private final OpenSslEngineMap engineMap | |
| maximumCacheSize | back to summary |
|---|---|
| private final AtomicInteger maximumCacheSize | |
| sessionCounter | back to summary |
|---|---|
| private int sessionCounter | |
| sessions | back to summary |
|---|---|
| private final Map<OpenSslSessionId, OpenSslSessionCache. | |
| sessionTimeout | back to summary |
|---|---|
| private final AtomicInteger sessionTimeout | |
| OpenSslSessionCache | back to summary |
|---|---|
| pack-priv OpenSslSessionCache(OpenSslEngineMap engineMap) | |
| clear | back to summary |
|---|---|
| pack-priv synchronized void clear() Clear the cache and free all cached SSL_SESSION*. | |
| containsSessionWithId | back to summary |
|---|---|
| pack-priv final synchronized boolean containsSessionWithId(OpenSslSessionId id) Returns | |
| expungeInvalidSessions | back to summary |
|---|---|
| private void expungeInvalidSessions() | |
| getIds | back to summary |
|---|---|
| pack-priv final List Returns a snapshot of the session ids of the current valid sessions. | |
| getSession | back to summary |
|---|---|
| public final long getSession(long ssl, byte[] sessionId) Implements io. Doc from io. Called once a
| |
| getSession | back to summary |
|---|---|
| pack-priv final synchronized OpenSslSession getSession(OpenSslSessionId id) Return the | |
| getSessionCacheSize | back to summary |
|---|---|
| pack-priv final int getSessionCacheSize() | |
| getSessionTimeout | back to summary |
|---|---|
| pack-priv final int getSessionTimeout() | |
| notifyRemovalAndFree | back to summary |
|---|---|
| private void notifyRemovalAndFree(OpenSslSessionCache. | |
| removeSessionWithId | back to summary |
|---|---|
| pack-priv final synchronized void removeSessionWithId(OpenSslSessionId id) Remove the session with the given id from the cache | |
| sessionCreated | back to summary |
|---|---|
| protected boolean sessionCreated(OpenSslSessionCache. Called once a new
| |
| sessionCreated | back to summary |
|---|---|
| public boolean sessionCreated(long ssl, long sslSession) Implements io. Doc from io. Returns
| |
| sessionRemoved | back to summary |
|---|---|
| protected void sessionRemoved(OpenSslSessionCache. Called once an
| |
| setSession | back to summary |
|---|---|
| pack-priv boolean setSession(long ssl, OpenSslSession session, String host, int port) | |
| setSessionCacheSize | back to summary |
|---|---|
| pack-priv final void setSessionCacheSize(int size) | |
| setSessionTimeout | back to summary |
|---|---|
| pack-priv final void setSessionTimeout(int seconds) | |
OpenSslSession implementation which wraps the native SSL_SESSION* while in cache.
| Modifier and Type | Field and Description |
|---|---|
| private final long | |
| private boolean | |
| private final OpenSslSessionId | |
| pack-priv final Map | |
| private volatile long | |
| pack-priv static final ResourceLeakDetector | |
| private final ResourceLeakTracker | |
| private final String | |
| private final int | |
| private final long | |
| private final long | |
| private volatile boolean |
| Access | Constructor and Description |
|---|---|
| pack-priv | NativeSslSession(long session, String peerHost, int peerPort, long timeout, Map<String, Object> keyValueStorage)
|
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | |
| public boolean | equals(Object
the reference object with which to compare. o)Overrides java. |
| pack-priv synchronized void | |
| public int | getApplicationBufferSize()
Implements javax. |
| public String | getCipherSuite()
Implements javax. |
| public long | getCreationTime()
Implements javax. |
| public byte[] | |
| public long | getLastAccessedTime()
Implements javax. |
| public Certificate[] | getLocalCertificates()
Implements javax. |
| public Principal | getLocalPrincipal()
Implements javax. |
| public int | getPacketBufferSize()
Implements javax. |
| public X509Certificate[] | getPeerCertificateChain()
Overrides default javax.
Deprecated
as a consequence of
Returns the identity of the peer which was identified as part
of defining the session.
X509Certificate being deprecated.
|
| public Certificate[] | getPeerCertificates()
Implements javax. |
| public String | getPeerHost()
Implements javax. |
| public int | getPeerPort()
Implements javax. |
| public Principal | getPeerPrincipal()
Implements javax. |
| public String | getProtocol()
Implements javax. |
| public OpenSslSessionContext | getSessionContext()
Implements io. |
| public Object | getValue(String
the name of the binding to find. name)Implements javax. |
| public String[] | getValueNames()
Implements javax. |
| public void | handshakeFinished(byte[] id, String cipher, String protocol, byte[] peerCertificate, byte[][] peerCertificateChain, long creationTime, long timeout)
Implements io. |
| public int | |
| public void | |
| pack-priv boolean | |
| public boolean | isValid()
Implements javax. |
| public Map | keyValueStorage()
Implements io. Map that is used by the following methods:
|
| public void | prepareHandshake()
Implements io. javax..
|
| public void | putValue(String
the name to which the data object will be bound.
This may not be null. name, Object the data object to be bound. This may not be null. value)Implements javax. value object into the
session's application layer data
with the given name.
|
| public void | removeValue(String
the name of the object to remove visible
across different access control contexts name)Implements javax. |
| pack-priv long | |
| public OpenSslSessionId | sessionId()
Implements io. OpenSslSessionId that can be used to identify this session.
|
| public void | setLastAccessedTime(long
the time time)Implements io. getLastAccessedTime().
|
| public void | setLocalCertificate(Certificate[] localCertificate)
Implements io. |
| public void | setSessionDetails(long
the time at which the session was created. creationTime, long the time at which the session was last accessed via the session infrastructure (cache). lastAccessedTime, OpenSslSessionId the id, Map<String, Object> OpenSslSessionIdthe key value store. See keyValueStorage)keyValueStorage().Implements io. |
| pack-priv boolean | |
| public void | tryExpandApplicationBufferSize(int
The packet size which exceeds the current packetLengthDataOnly)getApplicationBufferSize().Implements io. getApplicationBufferSize() if necessary.
|
| pack-priv boolean |
| creationTime | back to summary |
|---|---|
| private final long creationTime | |
| freed | back to summary |
|---|---|
| private boolean freed | |
| id | back to summary |
|---|---|
| private final OpenSslSessionId id | |
| keyValueStorage | back to summary |
|---|---|
| pack-priv final Map<String, Object> keyValueStorage | |
| lastAccessedTime | back to summary |
|---|---|
| private volatile long lastAccessedTime | |
| LEAK_DETECTOR | back to summary |
|---|---|
| pack-priv static final ResourceLeakDetector<OpenSslSessionCache. | |
| leakTracker | back to summary |
|---|---|
| private final ResourceLeakTracker<OpenSslSessionCache. | |
| peerHost | back to summary |
|---|---|
| private final String peerHost | |
| peerPort | back to summary |
|---|---|
| private final int peerPort | |
| session | back to summary |
|---|---|
| private final long session | |
| timeout | back to summary |
|---|---|
| private final long timeout | |
| valid | back to summary |
|---|---|
| private volatile boolean valid | |
| NativeSslSession | back to summary |
|---|---|
| pack-priv NativeSslSession(long session, String peerHost, int peerPort, long timeout, Map<String, Object> keyValueStorage) | |
| close | back to summary |
|---|---|
| pack-priv void close() | |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| free | back to summary |
|---|---|
| pack-priv synchronized void free() | |
| getApplicationBufferSize | back to summary |
|---|---|
| public int getApplicationBufferSize() Implements javax. Doc from javax. Gets the current size of the largest application data that is expected when using this session.
| |
| getCipherSuite | back to summary |
|---|---|
| public String getCipherSuite() Implements javax. Doc from javax. Returns the name of the SSL cipher suite which is used for all connections in the session. This defines the level of protection provided to the data sent on the connection, including the kind of encryption used and most aspects of how authentication is done. | |
| getCreationTime | back to summary |
|---|---|
| public long getCreationTime() Implements javax. Doc from javax. Returns the time at which this Session representation was created, in milliseconds since midnight, January 1, 1970 UTC.
| |
| getId | back to summary |
|---|---|
| public byte[] getId() Implements javax. Doc from javax. Returns the identifier assigned to this Session.
| |
| getLastAccessedTime | back to summary |
|---|---|
| public long getLastAccessedTime() Implements javax. Doc from javax. Returns the last time this Session representation was accessed by the session level infrastructure, in milliseconds since midnight, January 1, 1970 UTC. Access indicates a new connection being established using session data. Application level operations, such as getting or setting a value associated with the session, are not reflected in this access time. This information is particularly useful in session management policies. For example, a session manager thread could leave all sessions in a given context which haven't been used in a long time; or, the sessions might be sorted according to age to optimize some task.
| |
| getLocalCertificates | back to summary |
|---|---|
| public Certificate[] getLocalCertificates() Implements javax. Doc from javax. Returns the certificate(s) that were sent to the peer during handshaking. Note This method is useful only when using certificate-based cipher suites. When multiple certificates are available for use in a handshake, the implementation chooses what it considers the "best" certificate chain available, and transmits that to the other side. This method allows the caller to know which certificate chain was actually used.
| |
| getLocalPrincipal | back to summary |
|---|---|
| public Principal getLocalPrincipal() Implements javax. Doc from javax. Returns the principal that was sent to the peer during handshaking. | |
| getPacketBufferSize | back to summary |
|---|---|
| public int getPacketBufferSize() Implements javax. Doc from javax. Gets the current size of the largest SSL/TLS/DTLS packet that is expected when using this session.
An
| |
| getPeerCertificateChain | back to summary |
|---|---|
| public X509Certificate[] getPeerCertificateChain() Overrides default javax. Doc from javax. Deprecated as a consequence of Returns the identity of the peer which was identified as part of defining the session. Note This method can be used only when using certificate-based cipher suites; using it with non-certificate-based cipher suites, such as Kerberos, will throw an SSLPeerUnverifiedException. Note The returned value may not be a valid certificate chain and should not be relied on for trust decisions. Note this method exists for compatibility with previous
releases. New applications should use
| |
| getPeerCertificates | back to summary |
|---|---|
| public Certificate[] getPeerCertificates() Implements javax. Doc from javax. Returns the identity of the peer which was established as part of defining the session. Note This method can be used only when using certificate-based cipher suites; using it with non-certificate-based cipher suites, such as Kerberos, will throw an SSLPeerUnverifiedException. Note The returned value may not be a valid certificate chain and should not be relied on for trust decisions.
| |
| getPeerHost | back to summary |
|---|---|
| public String getPeerHost() Implements javax. Doc from javax. Returns the host name of the peer in this session. For the server, this is the client's host; and for the client, it is the server's host. The name may not be a fully qualified host name or even a host name at all as it may represent a string encoding of the peer's network address. If such a name is desired, it might be resolved through a name service based on the value returned by this method.
This value is not authenticated and should not be relied upon.
It is mainly used as a hint for | |
| getPeerPort | back to summary |
|---|---|
| public int getPeerPort() Implements javax. Doc from javax. Returns the port number of the peer in this session. For the server, this is the client's port number; and for the client, it is the server's port number.
This value is not authenticated and should not be relied upon.
It is mainly used as a hint for
| |
| getPeerPrincipal | back to summary |
|---|---|
| public Principal getPeerPrincipal() Implements javax. Doc from javax. Returns the identity of the peer which was established as part of defining the session. | |
| getProtocol | back to summary |
|---|---|
| public String getProtocol() Implements javax. Doc from javax. Returns the standard name of the protocol used for all connections in the session. This defines the protocol used in the connection. | |
| getSessionContext | back to summary |
|---|---|
| public OpenSslSessionContext getSessionContext() Implements io. Doc from javax. Returns the context in which this session is bound. This context may be unavailable in some environments, in which case this method returns null.
If the context is available and there is a
security manager installed, the caller may require
permission to access it or a security exception may be thrown.
In a Java environment, the security manager's
| |
| getValue | back to summary |
|---|---|
| public Object getValue(String name) Implements javax. Doc from javax. Returns the object bound to the given name in the session's application layer data. Returns null if there is no such binding. For security reasons, the same named values may not be visible across different access control contexts. | |
| getValueNames | back to summary |
|---|---|
| public String[] getValueNames() Implements javax. Doc from javax. Returns an array of the names of all the application layer data objects bound into the Session. For security reasons, the same named values may not be visible across different access control contexts. | |
| handshakeFinished | back to summary |
|---|---|
| public void handshakeFinished(byte[] id, String cipher, String protocol, byte[] peerCertificate, byte[][] peerCertificateChain, long creationTime, long timeout) Implements io. Doc from io. Called once the handshake has completed.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| invalidate | back to summary |
|---|---|
| public void invalidate() Implements javax. Doc from javax. Invalidates the session. Future connections will not be able to resume or join this session. However, any existing connection using this session can continue to use the session until the connection is closed.
| |
| isValid | back to summary |
|---|---|
| pack-priv boolean isValid(long now) | |
| isValid | back to summary |
|---|---|
| public boolean isValid() Implements javax. Doc from javax. Returns whether this session is valid and available for resuming or joining.
| |
| keyValueStorage | back to summary |
|---|---|
| public Map Implements io. Doc from io. Return the underlying Map must be thread-safe!
| |
| prepareHandshake | back to summary |
|---|---|
| public void prepareHandshake() Implements io. Doc from io. Called on a handshake session before being exposed to a
| |
| putValue | back to summary |
|---|---|
| public void putValue(String name, Object value) Implements javax. Doc from javax. Binds the specified
Any existing binding using the same For security reasons, the same named values may not be visible across different access control contexts. | |
| removeValue | back to summary |
|---|---|
| public void removeValue(String name) Implements javax. Doc from javax. Removes the object bound to the given name in the session's
application layer data. Does nothing if there is no object
bound to the given name. If the bound existing object
implements the For security reasons, the same named values may not be visible across different access control contexts. | |
| session | back to summary |
|---|---|
| pack-priv long session() | |
| sessionId | back to summary |
|---|---|
| public OpenSslSessionId sessionId() Implements io. Doc from io. Return the
| |
| setLastAccessedTime | back to summary |
|---|---|
| public void setLastAccessedTime(long time) Implements io. Doc from io. Set the last access time which will be returned by
| |
| setLocalCertificate | back to summary |
|---|---|
| public void setLocalCertificate(Certificate[] localCertificate) Implements io. Doc from io. Set the local certificate chain that is used. It is not expected that this array will be changed at all and so its ok to not copy the array.
| |
| setSessionDetails | back to summary |
|---|---|
| public void setSessionDetails(long creationTime, long lastAccessedTime, OpenSslSessionId id, Map<String, Object> keyValueStorage) Implements io. Doc from io. Set the details for the session which might come from a cache.
| |
| shouldBeSingleUse | back to summary |
|---|---|
| pack-priv boolean shouldBeSingleUse() | |
| tryExpandApplicationBufferSize | back to summary |
|---|---|
| public void tryExpandApplicationBufferSize(int packetLengthDataOnly) Implements io. Doc from io. Expand (or increase) the value returned by This is only called in a synchronized block, so no need to use atomic operations.
| |
| upRef | back to summary |
|---|---|
| pack-priv boolean upRef() | |