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
OpenSslSessionimplementation which wraps the native SSL_SESSION* while in cache.
-
-
Field Summary
Fields Modifier and Type Field Description private longcreationTimeprivate booleanfreedprivate OpenSslSessionIdidprivate longlastAccessedTime(package private) static ResourceLeakDetector<OpenSslSessionCache.NativeSslSession>LEAK_DETECTORprivate ResourceLeakTracker<OpenSslSessionCache.NativeSslSession>leakTrackerprivate java.lang.StringpeerHostprivate intpeerPortprivate longsessionprivate longtimeoutprivate booleanvalid
-
Constructor Summary
Constructors Constructor Description NativeSslSession(long session, java.lang.String peerHost, int peerPort, long timeout)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidclose()booleanequals(java.lang.Object o)(package private) voidfree()intgetApplicationBufferSize()java.lang.StringgetCipherSuite()longgetCreationTime()byte[]getId()longgetLastAccessedTime()java.security.cert.Certificate[]getLocalCertificates()java.security.PrincipalgetLocalPrincipal()intgetPacketBufferSize()javax.security.cert.X509Certificate[]getPeerCertificateChain()java.security.cert.Certificate[]getPeerCertificates()java.lang.StringgetPeerHost()intgetPeerPort()java.security.PrincipalgetPeerPrincipal()java.lang.StringgetProtocol()OpenSslSessionContextgetSessionContext()java.lang.ObjectgetValue(java.lang.String name)java.lang.String[]getValueNames()voidhandshakeFinished(byte[] id, java.lang.String cipher, java.lang.String protocol, byte[] peerCertificate, byte[][] peerCertificateChain, long creationTime, long timeout)Called once the handshake has completed.inthashCode()voidinvalidate()booleanisValid()(package private) booleanisValid(long now)voidputValue(java.lang.String name, java.lang.Object value)voidremoveValue(java.lang.String name)(package private) longsession()OpenSslSessionIdsessionId()Return theOpenSslSessionIdthat can be used to identify this session.voidsetLocalCertificate(java.security.cert.Certificate[] localCertificate)Set the local certificate chain that is used.voidsetSessionId(OpenSslSessionId id)Set theOpenSslSessionIdfor theOpenSslSession.(package private) booleanshouldBeSingleUse()voidtryExpandApplicationBufferSize(int packetLengthDataOnly)Expand (or increase) the value returned bySSLSession.getApplicationBufferSize()if necessary.(package private) voidupdateLastAccessedTime()(package private) booleanupRef()
-
-
-
Field Detail
-
LEAK_DETECTOR
static final ResourceLeakDetector<OpenSslSessionCache.NativeSslSession> LEAK_DETECTOR
-
leakTracker
private final ResourceLeakTracker<OpenSslSessionCache.NativeSslSession> leakTracker
-
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
-
setSessionId
public void setSessionId(OpenSslSessionId id)
Description copied from interface:OpenSslSessionSet theOpenSslSessionIdfor theOpenSslSession.- Specified by:
setSessionIdin interfaceOpenSslSession
-
shouldBeSingleUse
boolean shouldBeSingleUse()
-
session
long session()
-
upRef
boolean upRef()
-
free
void free()
-
close
void close()
-
sessionId
public OpenSslSessionId sessionId()
Description copied from interface:OpenSslSessionReturn theOpenSslSessionIdthat can be used to identify this session.- Specified by:
sessionIdin interfaceOpenSslSession
-
isValid
boolean isValid(long now)
-
setLocalCertificate
public void setLocalCertificate(java.security.cert.Certificate[] localCertificate)
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
public OpenSslSessionContext getSessionContext()
- Specified by:
getSessionContextin interfaceOpenSslSession- Specified by:
getSessionContextin interfacejavax.net.ssl.SSLSession
-
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, java.lang.String cipher, java.lang.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 interfacejavax.net.ssl.SSLSession
-
getCreationTime
public long getCreationTime()
- Specified by:
getCreationTimein interfacejavax.net.ssl.SSLSession
-
updateLastAccessedTime
void updateLastAccessedTime()
-
getLastAccessedTime
public long getLastAccessedTime()
- Specified by:
getLastAccessedTimein interfacejavax.net.ssl.SSLSession
-
invalidate
public void invalidate()
- Specified by:
invalidatein interfacejavax.net.ssl.SSLSession
-
isValid
public boolean isValid()
- Specified by:
isValidin interfacejavax.net.ssl.SSLSession
-
putValue
public void putValue(java.lang.String name, java.lang.Object value)- Specified by:
putValuein interfacejavax.net.ssl.SSLSession
-
getValue
public java.lang.Object getValue(java.lang.String name)
- Specified by:
getValuein interfacejavax.net.ssl.SSLSession
-
removeValue
public void removeValue(java.lang.String name)
- Specified by:
removeValuein interfacejavax.net.ssl.SSLSession
-
getValueNames
public java.lang.String[] getValueNames()
- Specified by:
getValueNamesin interfacejavax.net.ssl.SSLSession
-
getPeerCertificates
public java.security.cert.Certificate[] getPeerCertificates()
- Specified by:
getPeerCertificatesin interfacejavax.net.ssl.SSLSession
-
getLocalCertificates
public java.security.cert.Certificate[] getLocalCertificates()
- Specified by:
getLocalCertificatesin interfacejavax.net.ssl.SSLSession
-
getPeerCertificateChain
public javax.security.cert.X509Certificate[] getPeerCertificateChain()
- Specified by:
getPeerCertificateChainin interfacejavax.net.ssl.SSLSession
-
getPeerPrincipal
public java.security.Principal getPeerPrincipal()
- Specified by:
getPeerPrincipalin interfacejavax.net.ssl.SSLSession
-
getLocalPrincipal
public java.security.Principal getLocalPrincipal()
- Specified by:
getLocalPrincipalin interfacejavax.net.ssl.SSLSession
-
getCipherSuite
public java.lang.String getCipherSuite()
- Specified by:
getCipherSuitein interfacejavax.net.ssl.SSLSession
-
getProtocol
public java.lang.String getProtocol()
- Specified by:
getProtocolin interfacejavax.net.ssl.SSLSession
-
getPeerHost
public java.lang.String getPeerHost()
- Specified by:
getPeerHostin interfacejavax.net.ssl.SSLSession
-
getPeerPort
public int getPeerPort()
- Specified by:
getPeerPortin interfacejavax.net.ssl.SSLSession
-
getPacketBufferSize
public int getPacketBufferSize()
- Specified by:
getPacketBufferSizein interfacejavax.net.ssl.SSLSession
-
getApplicationBufferSize
public int getApplicationBufferSize()
- Specified by:
getApplicationBufferSizein interfacejavax.net.ssl.SSLSession
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
-