Package io.netty.handler.ssl
Class OpenSslSessionCache.NativeSslSession
java.lang.Object
io.netty.handler.ssl.OpenSslSessionCache.NativeSslSession
- All Implemented Interfaces:
OpenSslSession,SSLSession
- Enclosing class:
OpenSslSessionCache
OpenSslSession implementation which wraps the native SSL_SESSION* while in cache.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final longprivate booleanprivate final OpenSslSessionIdprivate long(package private) static final ResourceLeakDetector<OpenSslSessionCache.NativeSslSession> private final ResourceLeakTracker<OpenSslSessionCache.NativeSslSession> private final Stringprivate final intprivate final longprivate final longprivate boolean -
Constructor Summary
ConstructorsConstructorDescriptionNativeSslSession(long session, String peerHost, int peerPort, long timeout, Map<String, Object> keyValueStorage) -
Method Summary
Modifier and TypeMethodDescription(package private) voidclose()boolean(package private) voidfree()intlongbyte[]getId()longintintString[]voidhandshakeFinished(byte[] id, String cipher, String protocol, byte[] peerCertificate, byte[][] peerCertificateChain, long creationTime, long timeout) Called once the handshake has completed.inthashCode()voidbooleanisValid()(package private) booleanisValid(long now) Return the underlyingMapthat is used by the following methods:SSLSession.putValue(String, Object)SSLSession.removeValue(String)SSLSession.getValue(String)SSLSession.getValueNames()TheMapmust be thread-safe!voidCalled on a handshake session before being exposed to aTrustManager.voidvoidremoveValue(String name) (package private) longsession()Return theOpenSslSessionIdthat can be used to identify this session.voidsetLastAccessedTime(long time) Set the last access time which will be returned bySSLSession.getLastAccessedTime().voidsetLocalCertificate(Certificate[] localCertificate) Set the local certificate chain that is used.voidsetSessionDetails(long creationTime, long lastAccessedTime, OpenSslSessionId id, Map<String, Object> keyValueStorage) Set the details for the session which might come from a cache.(package private) booleanvoidtryExpandApplicationBufferSize(int packetLengthDataOnly) Expand (or increase) the value returned bySSLSession.getApplicationBufferSize()if necessary.(package private) booleanupRef()
-
Field Details
-
LEAK_DETECTOR
-
leakTracker
-
keyValueStorage
-
session
private final long session -
peerHost
-
peerPort
private final int peerPort -
id
-
timeout
private final long timeout -
creationTime
private final long creationTime -
lastAccessedTime
private volatile long lastAccessedTime -
valid
private volatile boolean valid -
freed
private boolean freed
-
-
Constructor Details
-
NativeSslSession
-
-
Method Details
-
keyValueStorage
Description copied from interface:OpenSslSessionReturn the underlyingMapthat is used by the following methods:SSLSession.putValue(String, Object)SSLSession.removeValue(String)SSLSession.getValue(String)-
SSLSession.getValueNames()
Mapmust be thread-safe!- Specified by:
keyValueStoragein interfaceOpenSslSession- Returns:
- storage
-
prepareHandshake
public void prepareHandshake()Description copied from interface:OpenSslSessionCalled on a handshake session before being exposed to aTrustManager. Session data must be cleared by this call.- Specified by:
prepareHandshakein interfaceOpenSslSession
-
setSessionDetails
public void setSessionDetails(long creationTime, long lastAccessedTime, OpenSslSessionId id, Map<String, Object> keyValueStorage) Description copied from interface:OpenSslSessionSet the details for the session which might come from a cache.- Specified by:
setSessionDetailsin interfaceOpenSslSession- Parameters:
creationTime- the time at which the session was created.lastAccessedTime- the time at which the session was last accessed via the session infrastructure (cache).id- theOpenSslSessionIdkeyValueStorage- the key value store. SeeOpenSslSession.keyValueStorage().
-
shouldBeSingleUse
boolean shouldBeSingleUse() -
session
long session() -
upRef
boolean upRef() -
free
void free() -
close
void close() -
sessionId
Description copied from interface:OpenSslSessionReturn theOpenSslSessionIdthat can be used to identify this session.- Specified by:
sessionIdin interfaceOpenSslSession
-
isValid
boolean isValid(long now) -
setLocalCertificate
Description copied from interface:OpenSslSessionSet 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.- Specified by:
setLocalCertificatein interfaceOpenSslSession
-
getSessionContext
- Specified by:
getSessionContextin interfaceOpenSslSession- Specified by:
getSessionContextin interfaceSSLSession
-
tryExpandApplicationBufferSize
public void tryExpandApplicationBufferSize(int packetLengthDataOnly) Description copied from interface:OpenSslSessionExpand (or increase) the value returned bySSLSession.getApplicationBufferSize()if necessary.This is only called in a synchronized block, so no need to use atomic operations.
- Specified by:
tryExpandApplicationBufferSizein interfaceOpenSslSession- Parameters:
packetLengthDataOnly- The packet size which exceeds the currentSSLSession.getApplicationBufferSize().
-
handshakeFinished
public void handshakeFinished(byte[] id, String cipher, String protocol, byte[] peerCertificate, byte[][] peerCertificateChain, long creationTime, long timeout) Description copied from interface:OpenSslSessionCalled once the handshake has completed.- Specified by:
handshakeFinishedin interfaceOpenSslSession
-
getId
public byte[] getId()- Specified by:
getIdin interfaceSSLSession
-
getCreationTime
public long getCreationTime()- Specified by:
getCreationTimein interfaceSSLSession
-
setLastAccessedTime
public void setLastAccessedTime(long time) Description copied from interface:OpenSslSessionSet the last access time which will be returned bySSLSession.getLastAccessedTime().- Specified by:
setLastAccessedTimein interfaceOpenSslSession- Parameters:
time- the time
-
getLastAccessedTime
public long getLastAccessedTime()- Specified by:
getLastAccessedTimein interfaceSSLSession
-
invalidate
public void invalidate()- Specified by:
invalidatein interfaceSSLSession
-
isValid
public boolean isValid()- Specified by:
isValidin interfaceSSLSession
-
putValue
- Specified by:
putValuein interfaceSSLSession
-
getValue
- Specified by:
getValuein interfaceSSLSession
-
removeValue
- Specified by:
removeValuein interfaceSSLSession
-
getValueNames
- Specified by:
getValueNamesin interfaceSSLSession
-
getPeerCertificates
- Specified by:
getPeerCertificatesin interfaceSSLSession
-
getLocalCertificates
- Specified by:
getLocalCertificatesin interfaceSSLSession
-
getPeerCertificateChain
- Specified by:
getPeerCertificateChainin interfaceSSLSession
-
getPeerPrincipal
- Specified by:
getPeerPrincipalin interfaceSSLSession
-
getLocalPrincipal
- Specified by:
getLocalPrincipalin interfaceSSLSession
-
getCipherSuite
- Specified by:
getCipherSuitein interfaceSSLSession
-
getProtocol
- Specified by:
getProtocolin interfaceSSLSession
-
getPeerHost
- Specified by:
getPeerHostin interfaceSSLSession
-
getPeerPort
public int getPeerPort()- Specified by:
getPeerPortin interfaceSSLSession
-
getPacketBufferSize
public int getPacketBufferSize()- Specified by:
getPacketBufferSizein interfaceSSLSession
-
getApplicationBufferSize
public int getApplicationBufferSize()- Specified by:
getApplicationBufferSizein interfaceSSLSession
-
hashCode
public int hashCode() -
equals
-