Package io.netty.handler.ssl
Class ReferenceCountedOpenSslEngine.DefaultOpenSslSession
- java.lang.Object
-
- io.netty.handler.ssl.ReferenceCountedOpenSslEngine.DefaultOpenSslSession
-
- All Implemented Interfaces:
OpenSslSession
,javax.net.ssl.SSLSession
- Enclosing class:
- ReferenceCountedOpenSslEngine
private final class ReferenceCountedOpenSslEngine.DefaultOpenSslSession extends java.lang.Object implements OpenSslSession
-
-
Field Summary
Fields Modifier and Type Field Description private int
applicationBufferSize
private java.lang.String
cipher
private long
creationTime
private OpenSslSessionId
id
private java.security.cert.Certificate[]
localCertificateChain
private java.security.cert.Certificate[]
peerCerts
private java.lang.String
protocol
private OpenSslSessionContext
sessionContext
private boolean
valid
private java.util.Map<java.lang.String,java.lang.Object>
values
private javax.security.cert.X509Certificate[]
x509PeerCerts
-
Constructor Summary
Constructors Constructor Description DefaultOpenSslSession(OpenSslSessionContext sessionContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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)
Finish the handshake and so init everything in theOpenSslSession
that should be accessible by the user.private void
initCerts(byte[][] chain, int startPos)
void
invalidate()
boolean
isValid()
private javax.net.ssl.SSLSessionBindingEvent
newSSLSessionBindingEvent(java.lang.String name)
private void
notifyUnbound(java.lang.Object value, java.lang.String name)
void
putValue(java.lang.String name, java.lang.Object value)
void
removeValue(java.lang.String name)
OpenSslSessionId
sessionId()
Return theOpenSslSessionId
that can be used to identify this session.void
setLocalCertificate(java.security.cert.Certificate[] localCertificate)
Set the local certificate chain that is used.void
setSessionId(OpenSslSessionId sessionId)
Set theOpenSslSessionId
for theOpenSslSession
.java.lang.String
toString()
void
tryExpandApplicationBufferSize(int packetLengthDataOnly)
Expand (or increase) the value returned bySSLSession.getApplicationBufferSize()
if necessary.
-
-
-
Field Detail
-
sessionContext
private final OpenSslSessionContext sessionContext
-
x509PeerCerts
private javax.security.cert.X509Certificate[] x509PeerCerts
-
peerCerts
private java.security.cert.Certificate[] peerCerts
-
valid
private boolean valid
-
protocol
private java.lang.String protocol
-
cipher
private java.lang.String cipher
-
id
private OpenSslSessionId id
-
creationTime
private volatile long creationTime
-
applicationBufferSize
private volatile int applicationBufferSize
-
localCertificateChain
private volatile java.security.cert.Certificate[] localCertificateChain
-
values
private java.util.Map<java.lang.String,java.lang.Object> values
-
-
Constructor Detail
-
DefaultOpenSslSession
DefaultOpenSslSession(OpenSslSessionContext sessionContext)
-
-
Method Detail
-
newSSLSessionBindingEvent
private javax.net.ssl.SSLSessionBindingEvent newSSLSessionBindingEvent(java.lang.String name)
-
setSessionId
public void setSessionId(OpenSslSessionId sessionId)
Description copied from interface:OpenSslSession
Set theOpenSslSessionId
for theOpenSslSession
.- Specified by:
setSessionId
in interfaceOpenSslSession
-
sessionId
public OpenSslSessionId sessionId()
Description copied from interface:OpenSslSession
Return theOpenSslSessionId
that can be used to identify this session.- Specified by:
sessionId
in interfaceOpenSslSession
-
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
-
getId
public byte[] getId()
- Specified by:
getId
in interfacejavax.net.ssl.SSLSession
-
getSessionContext
public OpenSslSessionContext getSessionContext()
- Specified by:
getSessionContext
in interfaceOpenSslSession
- Specified by:
getSessionContext
in interfacejavax.net.ssl.SSLSession
-
getCreationTime
public long getCreationTime()
- Specified by:
getCreationTime
in interfacejavax.net.ssl.SSLSession
-
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
-
notifyUnbound
private void notifyUnbound(java.lang.Object value, java.lang.String name)
-
handshakeFinished
public void handshakeFinished(byte[] id, java.lang.String cipher, java.lang.String protocol, byte[] peerCertificate, byte[][] peerCertificateChain, long creationTime, long timeout) throws javax.net.ssl.SSLException
Finish the handshake and so init everything in theOpenSslSession
that should be accessible by the user.- Specified by:
handshakeFinished
in interfaceOpenSslSession
- Throws:
javax.net.ssl.SSLException
-
initCerts
private void initCerts(byte[][] chain, int startPos)
-
getPeerCertificates
public java.security.cert.Certificate[] getPeerCertificates() throws javax.net.ssl.SSLPeerUnverifiedException
- Specified by:
getPeerCertificates
in interfacejavax.net.ssl.SSLSession
- Throws:
javax.net.ssl.SSLPeerUnverifiedException
-
getLocalCertificates
public java.security.cert.Certificate[] getLocalCertificates()
- Specified by:
getLocalCertificates
in interfacejavax.net.ssl.SSLSession
-
getPeerCertificateChain
public javax.security.cert.X509Certificate[] getPeerCertificateChain() throws javax.net.ssl.SSLPeerUnverifiedException
- Specified by:
getPeerCertificateChain
in interfacejavax.net.ssl.SSLSession
- Throws:
javax.net.ssl.SSLPeerUnverifiedException
-
getPeerPrincipal
public java.security.Principal getPeerPrincipal() throws javax.net.ssl.SSLPeerUnverifiedException
- Specified by:
getPeerPrincipal
in interfacejavax.net.ssl.SSLSession
- Throws:
javax.net.ssl.SSLPeerUnverifiedException
-
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
-
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
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-