public class ReferenceCountedOpenSslEngine extends 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() |
String |
getApplicationProtocol() |
Runnable |
getDelegatedTask() |
String[] |
getEnabledCipherSuites() |
String[] |
getEnabledProtocols() |
boolean |
getEnableSessionCreation() |
String |
getHandshakeApplicationProtocol() |
SSLSession |
getHandshakeSession() |
SSLEngineResult.HandshakeStatus |
getHandshakeStatus() |
boolean |
getNeedClientAuth() |
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. |
SSLSession |
getSession() |
SSLParameters |
getSSLParameters() |
String[] |
getSupportedCipherSuites() |
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(String[] cipherSuites) |
void |
setEnabledProtocols(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(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 . |
ReferenceCounted |
touch()
Records the current access location of this object for debugging purposes.
|
ReferenceCounted |
touch(Object hint)
Records the current access location of this object with an additional arbitrary information for debugging
purposes.
|
SSLEngineResult |
unwrap(ByteBuffer[] srcs,
ByteBuffer[] dsts) |
SSLEngineResult |
unwrap(ByteBuffer[] srcs,
int srcsOffset,
int srcsLength,
ByteBuffer[] dsts,
int dstsOffset,
int dstsLength) |
SSLEngineResult |
unwrap(ByteBuffer src,
ByteBuffer dst) |
SSLEngineResult |
unwrap(ByteBuffer src,
ByteBuffer[] dsts) |
SSLEngineResult |
unwrap(ByteBuffer src,
ByteBuffer[] dsts,
int offset,
int length) |
SSLEngineResult |
wrap(ByteBuffer[] srcs,
int offset,
int length,
ByteBuffer dst) |
SSLEngineResult |
wrap(ByteBuffer src,
ByteBuffer dst) |
getHandshakeApplicationProtocolSelector, getPeerHost, getPeerPort, setHandshakeApplicationProtocolSelector, wrap
@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 ReferenceCounted touch()
ReferenceCounted
ResourceLeakDetector
. This method is a shortcut to touch(null)
.touch
in interface ReferenceCounted
public final ReferenceCounted touch(Object hint)
ReferenceCounted
ResourceLeakDetector
.touch
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 String getApplicationProtocol()
getApplicationProtocol
in class SSLEngine
public String getHandshakeApplicationProtocol()
getHandshakeApplicationProtocol
in class SSLEngine
public final SSLSession getHandshakeSession()
getHandshakeSession
in class 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 SSLEngineResult wrap(ByteBuffer[] srcs, int offset, int length, ByteBuffer dst) throws SSLException
wrap
in class SSLEngine
SSLException
public final SSLEngineResult unwrap(ByteBuffer[] srcs, int srcsOffset, int srcsLength, ByteBuffer[] dsts, int dstsOffset, int dstsLength) throws SSLException
SSLException
public final SSLEngineResult unwrap(ByteBuffer[] srcs, ByteBuffer[] dsts) throws SSLException
SSLException
public final SSLEngineResult unwrap(ByteBuffer src, ByteBuffer[] dsts, int offset, int length) throws SSLException
unwrap
in class SSLEngine
SSLException
public final SSLEngineResult wrap(ByteBuffer src, ByteBuffer dst) throws SSLException
wrap
in class SSLEngine
SSLException
public final SSLEngineResult unwrap(ByteBuffer src, ByteBuffer dst) throws SSLException
unwrap
in class SSLEngine
SSLException
public final SSLEngineResult unwrap(ByteBuffer src, ByteBuffer[] dsts) throws SSLException
unwrap
in class SSLEngine
SSLException
public final Runnable getDelegatedTask()
getDelegatedTask
in class SSLEngine
public final void closeInbound() throws SSLException
closeInbound
in class SSLEngine
SSLException
public final boolean isInboundDone()
isInboundDone
in class SSLEngine
public final void closeOutbound()
closeOutbound
in class SSLEngine
public final boolean isOutboundDone()
isOutboundDone
in class SSLEngine
public final String[] getSupportedCipherSuites()
getSupportedCipherSuites
in class SSLEngine
public final String[] getEnabledCipherSuites()
getEnabledCipherSuites
in class SSLEngine
public final void setEnabledCipherSuites(String[] cipherSuites)
setEnabledCipherSuites
in class SSLEngine
public final String[] getSupportedProtocols()
getSupportedProtocols
in class SSLEngine
public final String[] getEnabledProtocols()
getEnabledProtocols
in class SSLEngine
public final void setEnabledProtocols(String[] protocols)
setEnabledProtocols
in class SSLEngine
public final SSLSession getSession()
getSession
in class SSLEngine
public final void beginHandshake() throws SSLException
beginHandshake
in class SSLEngine
SSLException
public final SSLEngineResult.HandshakeStatus getHandshakeStatus()
getHandshakeStatus
in class SSLEngine
public final void setUseClientMode(boolean clientMode)
setUseClientMode
in class SSLEngine
public final boolean getUseClientMode()
getUseClientMode
in class SSLEngine
public final void setNeedClientAuth(boolean b)
setNeedClientAuth
in class SSLEngine
public final boolean getNeedClientAuth()
getNeedClientAuth
in class SSLEngine
public final void setWantClientAuth(boolean b)
setWantClientAuth
in class SSLEngine
public final boolean getWantClientAuth()
getWantClientAuth
in class SSLEngine
@UnstableApi public final void setVerify(int verifyMode, int depth)
SSL.setVerify(long, int, int)
.public final void setEnableSessionCreation(boolean b)
setEnableSessionCreation
in class SSLEngine
public final boolean getEnableSessionCreation()
getEnableSessionCreation
in class SSLEngine
public final SSLParameters getSSLParameters()
getSSLParameters
in class SSLEngine
public final void setSSLParameters(SSLParameters sslParameters)
setSSLParameters
in class SSLEngine
public String getNegotiatedApplicationProtocol()
null
if the negotiation failed or the client does not have ALPN/NPN extensionCopyright © 2008–2024 The Netty Project. All rights reserved.