Package io.netty.handler.ssl
Class ReferenceCountedOpenSslEngine.DefaultOpenSslSession
java.lang.Object
io.netty.handler.ssl.ReferenceCountedOpenSslEngine.DefaultOpenSslSession
- All Implemented Interfaces:
OpenSslSession
,SSLSession
- Enclosing class:
ReferenceCountedOpenSslEngine
private final class ReferenceCountedOpenSslEngine.DefaultOpenSslSession
extends Object
implements OpenSslSession
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private String
private long
private OpenSslSessionId
private long
private Certificate[]
private Certificate[]
private String
private final OpenSslSessionContext
private boolean
private X509Certificate[]
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
int
long
byte[]
getId()
long
int
int
String[]
void
handshakeFinished
(byte[] id, String cipher, String protocol, byte[] peerCertificate, byte[][] peerCertificateChain, long creationTime, long timeout) Finish the handshake and so init everything in theOpenSslSession
that should be accessible by the user.int
hashCode()
private void
initCerts
(byte[][] chain, int startPos) void
boolean
isValid()
Return the underlyingMap
that is used by the following methods:SSLSession.putValue(String, Object)
SSLSession.removeValue(String)
SSLSession.getValue(String)
SSLSession.getValueNames()
TheMap
must be thread-safe!private SSLSessionBindingEvent
private void
notifyUnbound
(Object value, String name) void
Called on a handshake session before being exposed to aTrustManager
.void
void
removeValue
(String name) Return theOpenSslSessionId
that can be used to identify this session.void
setLastAccessedTime
(long time) Set the last access time which will be returned bySSLSession.getLastAccessedTime()
.void
setLocalCertificate
(Certificate[] localCertificate) Set the local certificate chain that is used.void
setSessionDetails
(long creationTime, long lastAccessedTime, OpenSslSessionId sessionId, Map<String, Object> keyValueStorage) Set the details for the session which might come from a cache.toString()
void
tryExpandApplicationBufferSize
(int packetLengthDataOnly) Expand (or increase) the value returned bySSLSession.getApplicationBufferSize()
if necessary.
-
Field Details
-
sessionContext
-
x509PeerCerts
-
peerCerts
-
valid
private boolean valid -
protocol
-
cipher
-
id
-
creationTime
private long creationTime -
lastAccessed
private long lastAccessed -
applicationBufferSize
private volatile int applicationBufferSize -
localCertificateChain
-
keyValueStorage
-
-
Constructor Details
-
DefaultOpenSslSession
DefaultOpenSslSession(OpenSslSessionContext sessionContext)
-
-
Method Details
-
newSSLSessionBindingEvent
-
prepareHandshake
public void prepareHandshake()Description copied from interface:OpenSslSession
Called on a handshake session before being exposed to aTrustManager
. Session data must be cleared by this call.- Specified by:
prepareHandshake
in interfaceOpenSslSession
-
setSessionDetails
public void setSessionDetails(long creationTime, long lastAccessedTime, OpenSslSessionId sessionId, Map<String, Object> keyValueStorage) Description copied from interface:OpenSslSession
Set the details for the session which might come from a cache.- Specified by:
setSessionDetails
in 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).sessionId
- theOpenSslSessionId
keyValueStorage
- the key value store. SeeOpenSslSession.keyValueStorage()
.
-
keyValueStorage
Description copied from interface:OpenSslSession
Return the underlyingMap
that is used by the following methods:SSLSession.putValue(String, Object)
SSLSession.removeValue(String)
SSLSession.getValue(String)
-
SSLSession.getValueNames()
Map
must be thread-safe!- Specified by:
keyValueStorage
in interfaceOpenSslSession
- Returns:
- storage
-
sessionId
Description copied from interface:OpenSslSession
Return theOpenSslSessionId
that can be used to identify this session.- Specified by:
sessionId
in interfaceOpenSslSession
-
setLocalCertificate
Description copied from interface:OpenSslSession
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.- Specified by:
setLocalCertificate
in interfaceOpenSslSession
-
getId
public byte[] getId()- Specified by:
getId
in interfaceSSLSession
-
getSessionContext
- Specified by:
getSessionContext
in interfaceOpenSslSession
- Specified by:
getSessionContext
in interfaceSSLSession
-
getCreationTime
public long getCreationTime()- Specified by:
getCreationTime
in interfaceSSLSession
-
setLastAccessedTime
public void setLastAccessedTime(long time) Description copied from interface:OpenSslSession
Set the last access time which will be returned bySSLSession.getLastAccessedTime()
.- Specified by:
setLastAccessedTime
in interfaceOpenSslSession
- Parameters:
time
- the time
-
getLastAccessedTime
public long getLastAccessedTime()- Specified by:
getLastAccessedTime
in interfaceSSLSession
-
invalidate
public void invalidate()- Specified by:
invalidate
in interfaceSSLSession
-
isValid
public boolean isValid()- Specified by:
isValid
in interfaceSSLSession
-
putValue
- Specified by:
putValue
in interfaceSSLSession
-
getValue
- Specified by:
getValue
in interfaceSSLSession
-
removeValue
- Specified by:
removeValue
in interfaceSSLSession
-
getValueNames
- Specified by:
getValueNames
in interfaceSSLSession
-
notifyUnbound
-
handshakeFinished
public void handshakeFinished(byte[] id, String cipher, String protocol, byte[] peerCertificate, byte[][] peerCertificateChain, long creationTime, long timeout) throws SSLException Finish the handshake and so init everything in theOpenSslSession
that should be accessible by the user.- Specified by:
handshakeFinished
in interfaceOpenSslSession
- Throws:
SSLException
-
initCerts
private void initCerts(byte[][] chain, int startPos) -
getPeerCertificates
- Specified by:
getPeerCertificates
in interfaceSSLSession
- Throws:
SSLPeerUnverifiedException
-
getLocalCertificates
- Specified by:
getLocalCertificates
in interfaceSSLSession
-
getPeerCertificateChain
- Specified by:
getPeerCertificateChain
in interfaceSSLSession
- Throws:
SSLPeerUnverifiedException
-
getPeerPrincipal
- Specified by:
getPeerPrincipal
in interfaceSSLSession
- Throws:
SSLPeerUnverifiedException
-
getLocalPrincipal
- Specified by:
getLocalPrincipal
in interfaceSSLSession
-
getCipherSuite
- Specified by:
getCipherSuite
in interfaceSSLSession
-
getProtocol
- Specified by:
getProtocol
in interfaceSSLSession
-
getPeerHost
- Specified by:
getPeerHost
in interfaceSSLSession
-
getPeerPort
public int getPeerPort()- Specified by:
getPeerPort
in interfaceSSLSession
-
getPacketBufferSize
public int getPacketBufferSize()- Specified by:
getPacketBufferSize
in interfaceSSLSession
-
getApplicationBufferSize
public int getApplicationBufferSize()- Specified by:
getApplicationBufferSize
in interfaceSSLSession
-
tryExpandApplicationBufferSize
public void tryExpandApplicationBufferSize(int packetLengthDataOnly) Description copied from interface:OpenSslSession
Expand (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:
tryExpandApplicationBufferSize
in interfaceOpenSslSession
- Parameters:
packetLengthDataOnly
- The packet size which exceeds the currentSSLSession.getApplicationBufferSize()
.
-
toString
-
hashCode
public int hashCode() -
equals
-