Package io.netty.handler.ssl
Class OpenSslSessionCache.NativeSslSession
- java.lang.Object
-
- io.netty.handler.ssl.OpenSslSessionCache.NativeSslSession
-
- All Implemented Interfaces:
OpenSslSession
,javax.net.ssl.SSLSession
- Enclosing class:
- OpenSslSessionCache
static final class OpenSslSessionCache.NativeSslSession extends java.lang.Object implements OpenSslSession
OpenSslSession
implementation which wraps the native SSL_SESSION* while in cache.
-
-
Field Summary
Fields Modifier and Type Field Description private long
creationTime
private boolean
freed
private OpenSslSessionId
id
(package private) java.util.Map<java.lang.String,java.lang.Object>
keyValueStorage
private long
lastAccessedTime
(package private) static ResourceLeakDetector<OpenSslSessionCache.NativeSslSession>
LEAK_DETECTOR
private ResourceLeakTracker<OpenSslSessionCache.NativeSslSession>
leakTracker
private java.lang.String
peerHost
private int
peerPort
private long
session
private long
timeout
private boolean
valid
-
Constructor Summary
Constructors Constructor Description NativeSslSession(long session, java.lang.String peerHost, int peerPort, long timeout, java.util.Map<java.lang.String,java.lang.Object> keyValueStorage)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
close()
boolean
equals(java.lang.Object o)
(package private) void
free()
int
getApplicationBufferSize()
java.lang.String
getCipherSuite()
long
getCreationTime()
byte[]
getId()
long
getLastAccessedTime()
java.security.cert.Certificate[]
getLocalCertificates()
java.security.Principal
getLocalPrincipal()
int
getPacketBufferSize()
javax.security.cert.X509Certificate[]
getPeerCertificateChain()
java.security.cert.Certificate[]
getPeerCertificates()
java.lang.String
getPeerHost()
int
getPeerPort()
java.security.Principal
getPeerPrincipal()
java.lang.String
getProtocol()
OpenSslSessionContext
getSessionContext()
java.lang.Object
getValue(java.lang.String name)
java.lang.String[]
getValueNames()
void
handshakeFinished(byte[] id, java.lang.String cipher, java.lang.String protocol, byte[] peerCertificate, byte[][] peerCertificateChain, long creationTime, long timeout)
Called once the handshake has completed.int
hashCode()
void
invalidate()
boolean
isValid()
(package private) boolean
isValid(long now)
java.util.Map<java.lang.String,java.lang.Object>
keyValueStorage()
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!void
prepareHandshake()
Called on a handshake session before being exposed to aTrustManager
.void
putValue(java.lang.String name, java.lang.Object value)
void
removeValue(java.lang.String name)
(package private) long
session()
OpenSslSessionId
sessionId()
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(java.security.cert.Certificate[] localCertificate)
Set the local certificate chain that is used.void
setSessionDetails(long creationTime, long lastAccessedTime, OpenSslSessionId id, java.util.Map<java.lang.String,java.lang.Object> keyValueStorage)
Set the details for the session which might come from a cache.(package private) boolean
shouldBeSingleUse()
void
tryExpandApplicationBufferSize(int packetLengthDataOnly)
Expand (or increase) the value returned bySSLSession.getApplicationBufferSize()
if necessary.(package private) boolean
upRef()
-
-
-
Field Detail
-
LEAK_DETECTOR
static final ResourceLeakDetector<OpenSslSessionCache.NativeSslSession> LEAK_DETECTOR
-
leakTracker
private final ResourceLeakTracker<OpenSslSessionCache.NativeSslSession> leakTracker
-
keyValueStorage
final java.util.Map<java.lang.String,java.lang.Object> keyValueStorage
-
session
private final long session
-
peerHost
private final java.lang.String peerHost
-
peerPort
private final int peerPort
-
id
private final OpenSslSessionId 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
-
-
Method Detail
-
keyValueStorage
public java.util.Map<java.lang.String,java.lang.Object> 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
-
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 id, java.util.Map<java.lang.String,java.lang.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).id
- theOpenSslSessionId
keyValueStorage
- the key value store. SeeOpenSslSession.keyValueStorage()
.
-
shouldBeSingleUse
boolean shouldBeSingleUse()
-
session
long session()
-
upRef
boolean upRef()
-
free
void free()
-
close
void close()
-
sessionId
public OpenSslSessionId sessionId()
Description copied from interface:OpenSslSession
Return theOpenSslSessionId
that can be used to identify this session.- Specified by:
sessionId
in interfaceOpenSslSession
-
isValid
boolean isValid(long now)
-
setLocalCertificate
public void setLocalCertificate(java.security.cert.Certificate[] localCertificate)
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
-
getSessionContext
public OpenSslSessionContext getSessionContext()
- Specified by:
getSessionContext
in interfaceOpenSslSession
- Specified by:
getSessionContext
in interfacejavax.net.ssl.SSLSession
-
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()
.
-
handshakeFinished
public void handshakeFinished(byte[] id, java.lang.String cipher, java.lang.String protocol, byte[] peerCertificate, byte[][] peerCertificateChain, long creationTime, long timeout)
Description copied from interface:OpenSslSession
Called once the handshake has completed.- Specified by:
handshakeFinished
in interfaceOpenSslSession
-
getId
public byte[] getId()
- Specified by:
getId
in interfacejavax.net.ssl.SSLSession
-
getCreationTime
public long getCreationTime()
- Specified by:
getCreationTime
in interfacejavax.net.ssl.SSLSession
-
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 interfacejavax.net.ssl.SSLSession
-
invalidate
public void invalidate()
- Specified by:
invalidate
in interfacejavax.net.ssl.SSLSession
-
isValid
public boolean isValid()
- Specified by:
isValid
in interfacejavax.net.ssl.SSLSession
-
putValue
public void putValue(java.lang.String name, java.lang.Object value)
- Specified by:
putValue
in interfacejavax.net.ssl.SSLSession
-
getValue
public java.lang.Object getValue(java.lang.String name)
- Specified by:
getValue
in interfacejavax.net.ssl.SSLSession
-
removeValue
public void removeValue(java.lang.String name)
- Specified by:
removeValue
in interfacejavax.net.ssl.SSLSession
-
getValueNames
public java.lang.String[] getValueNames()
- Specified by:
getValueNames
in interfacejavax.net.ssl.SSLSession
-
getPeerCertificates
public java.security.cert.Certificate[] getPeerCertificates()
- Specified by:
getPeerCertificates
in interfacejavax.net.ssl.SSLSession
-
getLocalCertificates
public java.security.cert.Certificate[] getLocalCertificates()
- Specified by:
getLocalCertificates
in interfacejavax.net.ssl.SSLSession
-
getPeerCertificateChain
public javax.security.cert.X509Certificate[] getPeerCertificateChain()
- Specified by:
getPeerCertificateChain
in interfacejavax.net.ssl.SSLSession
-
getPeerPrincipal
public java.security.Principal getPeerPrincipal()
- Specified by:
getPeerPrincipal
in interfacejavax.net.ssl.SSLSession
-
getLocalPrincipal
public java.security.Principal getLocalPrincipal()
- Specified by:
getLocalPrincipal
in interfacejavax.net.ssl.SSLSession
-
getCipherSuite
public java.lang.String getCipherSuite()
- Specified by:
getCipherSuite
in interfacejavax.net.ssl.SSLSession
-
getProtocol
public java.lang.String getProtocol()
- Specified by:
getProtocol
in interfacejavax.net.ssl.SSLSession
-
getPeerHost
public java.lang.String getPeerHost()
- Specified by:
getPeerHost
in interfacejavax.net.ssl.SSLSession
-
getPeerPort
public int getPeerPort()
- Specified by:
getPeerPort
in interfacejavax.net.ssl.SSLSession
-
getPacketBufferSize
public int getPacketBufferSize()
- Specified by:
getPacketBufferSize
in interfacejavax.net.ssl.SSLSession
-
getApplicationBufferSize
public int getApplicationBufferSize()
- Specified by:
getApplicationBufferSize
in interfacejavax.net.ssl.SSLSession
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
-