public class ReferenceCountedOpenSslEngine extends javax.net.ssl.SSLEngine implements ReferenceCounted
SSLEngine
using
OpenSSL BIO abstractions.
Instances of this class must be released
or else native memory will leak!
Instances of this class must be released before the ReferenceCountedOpenSslContext
the instance depends upon are released. Otherwise if any method of this class is called which uses the
the ReferenceCountedOpenSslContext
JNI resources the JVM may crash.
Modifier and Type | Method and Description |
---|---|
void |
beginHandshake() |
void |
closeInbound() |
void |
closeOutbound() |
java.lang.Runnable |
getDelegatedTask() |
java.lang.String[] |
getEnabledCipherSuites() |
java.lang.String[] |
getEnabledProtocols() |
boolean |
getEnableSessionCreation() |
javax.net.ssl.SSLSession |
getHandshakeSession() |
javax.net.ssl.SSLEngineResult.HandshakeStatus |
getHandshakeStatus() |
boolean |
getNeedClientAuth() |
java.lang.String |
getNegotiatedApplicationProtocol()
Returns the name of the negotiated application-level protocol.
|
byte[] |
getOcspResponse()
Returns the OCSP response or
null if the server didn't provide a stapled OCSP response. |
javax.net.ssl.SSLSession |
getSession() |
javax.net.ssl.SSLParameters |
getSSLParameters() |
java.lang.String[] |
getSupportedCipherSuites() |
java.lang.String[] |
getSupportedProtocols() |
boolean |
getUseClientMode() |
boolean |
getWantClientAuth() |
boolean |
isInboundDone() |
boolean |
isOutboundDone() |
int |
refCnt()
Returns the reference count of this object.
|
boolean |
release()
Decreases the reference count by
1 and deallocates this object if the reference count reaches at
0 . |
boolean |
release(int decrement)
Decreases the reference count by the specified
decrement and deallocates this object if the reference
count reaches at 0 . |
ReferenceCounted |
retain()
Increases the reference count by
1 . |
ReferenceCounted |
retain(int increment)
Increases the reference count by the specified
increment . |
void |
setEnabledCipherSuites(java.lang.String[] cipherSuites) |
void |
setEnabledProtocols(java.lang.String[] protocols)
TLS doesn't support a way to advertise non-contiguous versions from the client's perspective, and the client
just advertises the max supported version.
|
void |
setEnableSessionCreation(boolean b) |
void |
setNeedClientAuth(boolean b) |
void |
setOcspResponse(byte[] response)
Sets the OCSP response.
|
void |
setSSLParameters(javax.net.ssl.SSLParameters sslParameters) |
void |
setUseClientMode(boolean clientMode) |
void |
setVerify(int verifyMode,
int depth)
See SSL_set_verify and
SSL.setVerify(long, int, int) . |
void |
setWantClientAuth(boolean b) |
void |
shutdown()
Destroys this engine.
|
long |
sslPointer()
Returns the pointer to the
SSL object for this ReferenceCountedOpenSslEngine . |
javax.net.ssl.SSLEngineResult |
unwrap(java.nio.ByteBuffer[] srcs,
java.nio.ByteBuffer[] dsts) |
javax.net.ssl.SSLEngineResult |
unwrap(java.nio.ByteBuffer[] srcs,
int srcsOffset,
int srcsLength,
java.nio.ByteBuffer[] dsts,
int dstsOffset,
int dstsLength) |
javax.net.ssl.SSLEngineResult |
unwrap(java.nio.ByteBuffer src,
java.nio.ByteBuffer dst) |
javax.net.ssl.SSLEngineResult |
unwrap(java.nio.ByteBuffer src,
java.nio.ByteBuffer[] dsts) |
javax.net.ssl.SSLEngineResult |
unwrap(java.nio.ByteBuffer src,
java.nio.ByteBuffer[] dsts,
int offset,
int length) |
javax.net.ssl.SSLEngineResult |
wrap(java.nio.ByteBuffer[] srcs,
int offset,
int length,
java.nio.ByteBuffer dst) |
javax.net.ssl.SSLEngineResult |
wrap(java.nio.ByteBuffer src,
java.nio.ByteBuffer dst) |
@UnstableApi public void setOcspResponse(byte[] response)
@UnstableApi public byte[] getOcspResponse()
null
if the server didn't provide a stapled OCSP response.public final int refCnt()
ReferenceCounted
0
, it means this object has been deallocated.refCnt
in interface ReferenceCounted
public final ReferenceCounted retain()
ReferenceCounted
1
.retain
in interface ReferenceCounted
public final ReferenceCounted retain(int increment)
ReferenceCounted
increment
.retain
in interface ReferenceCounted
public final boolean release()
ReferenceCounted
1
and deallocates this object if the reference count reaches at
0
.release
in interface ReferenceCounted
true
if and only if the reference count became 0
and this object has been deallocatedpublic final boolean release(int decrement)
ReferenceCounted
decrement
and deallocates this object if the reference
count reaches at 0
.release
in interface ReferenceCounted
true
if and only if the reference count became 0
and this object has been deallocatedpublic final javax.net.ssl.SSLSession getHandshakeSession()
getHandshakeSession
in class javax.net.ssl.SSLEngine
public final long sslPointer()
SSL
object for this ReferenceCountedOpenSslEngine
.
Be aware that it is freed as soon as the release()
or shutdown()
methods are called.
At this point 0
will be returned.public final void shutdown()
public final javax.net.ssl.SSLEngineResult wrap(java.nio.ByteBuffer[] srcs, int offset, int length, java.nio.ByteBuffer dst) throws javax.net.ssl.SSLException
wrap
in class javax.net.ssl.SSLEngine
javax.net.ssl.SSLException
public final javax.net.ssl.SSLEngineResult unwrap(java.nio.ByteBuffer[] srcs, int srcsOffset, int srcsLength, java.nio.ByteBuffer[] dsts, int dstsOffset, int dstsLength) throws javax.net.ssl.SSLException
javax.net.ssl.SSLException
public final javax.net.ssl.SSLEngineResult unwrap(java.nio.ByteBuffer[] srcs, java.nio.ByteBuffer[] dsts) throws javax.net.ssl.SSLException
javax.net.ssl.SSLException
public final javax.net.ssl.SSLEngineResult unwrap(java.nio.ByteBuffer src, java.nio.ByteBuffer[] dsts, int offset, int length) throws javax.net.ssl.SSLException
unwrap
in class javax.net.ssl.SSLEngine
javax.net.ssl.SSLException
public final javax.net.ssl.SSLEngineResult wrap(java.nio.ByteBuffer src, java.nio.ByteBuffer dst) throws javax.net.ssl.SSLException
wrap
in class javax.net.ssl.SSLEngine
javax.net.ssl.SSLException
public final javax.net.ssl.SSLEngineResult unwrap(java.nio.ByteBuffer src, java.nio.ByteBuffer dst) throws javax.net.ssl.SSLException
unwrap
in class javax.net.ssl.SSLEngine
javax.net.ssl.SSLException
public final javax.net.ssl.SSLEngineResult unwrap(java.nio.ByteBuffer src, java.nio.ByteBuffer[] dsts) throws javax.net.ssl.SSLException
unwrap
in class javax.net.ssl.SSLEngine
javax.net.ssl.SSLException
public final java.lang.Runnable getDelegatedTask()
getDelegatedTask
in class javax.net.ssl.SSLEngine
public final void closeInbound() throws javax.net.ssl.SSLException
closeInbound
in class javax.net.ssl.SSLEngine
javax.net.ssl.SSLException
public final boolean isInboundDone()
isInboundDone
in class javax.net.ssl.SSLEngine
public final void closeOutbound()
closeOutbound
in class javax.net.ssl.SSLEngine
public final boolean isOutboundDone()
isOutboundDone
in class javax.net.ssl.SSLEngine
public final java.lang.String[] getSupportedCipherSuites()
getSupportedCipherSuites
in class javax.net.ssl.SSLEngine
public final java.lang.String[] getEnabledCipherSuites()
getEnabledCipherSuites
in class javax.net.ssl.SSLEngine
public final void setEnabledCipherSuites(java.lang.String[] cipherSuites)
setEnabledCipherSuites
in class javax.net.ssl.SSLEngine
public final java.lang.String[] getSupportedProtocols()
getSupportedProtocols
in class javax.net.ssl.SSLEngine
public final java.lang.String[] getEnabledProtocols()
getEnabledProtocols
in class javax.net.ssl.SSLEngine
public final void setEnabledProtocols(java.lang.String[] protocols)
setEnabledProtocols
in class javax.net.ssl.SSLEngine
public final javax.net.ssl.SSLSession getSession()
getSession
in class javax.net.ssl.SSLEngine
public final void beginHandshake() throws javax.net.ssl.SSLException
beginHandshake
in class javax.net.ssl.SSLEngine
javax.net.ssl.SSLException
public final javax.net.ssl.SSLEngineResult.HandshakeStatus getHandshakeStatus()
getHandshakeStatus
in class javax.net.ssl.SSLEngine
public final void setUseClientMode(boolean clientMode)
setUseClientMode
in class javax.net.ssl.SSLEngine
public final boolean getUseClientMode()
getUseClientMode
in class javax.net.ssl.SSLEngine
public final void setNeedClientAuth(boolean b)
setNeedClientAuth
in class javax.net.ssl.SSLEngine
public final boolean getNeedClientAuth()
getNeedClientAuth
in class javax.net.ssl.SSLEngine
public final void setWantClientAuth(boolean b)
setWantClientAuth
in class javax.net.ssl.SSLEngine
public final boolean getWantClientAuth()
getWantClientAuth
in class javax.net.ssl.SSLEngine
@UnstableApi public final void setVerify(int verifyMode, int depth)
SSL.setVerify(long, int, int)
.public final void setEnableSessionCreation(boolean b)
setEnableSessionCreation
in class javax.net.ssl.SSLEngine
public final boolean getEnableSessionCreation()
getEnableSessionCreation
in class javax.net.ssl.SSLEngine
public final javax.net.ssl.SSLParameters getSSLParameters()
getSSLParameters
in class javax.net.ssl.SSLEngine
public final void setSSLParameters(javax.net.ssl.SSLParameters sslParameters)
setSSLParameters
in class javax.net.ssl.SSLEngine
public java.lang.String getNegotiatedApplicationProtocol()
null
if the negotiation failed or the client does not have ALPN/NPN extensionCopyright © 2008–2018 The Netty Project. All rights reserved.