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()
ReferenceCounted0, it means this object has been deallocated.refCnt in interface ReferenceCountedpublic final ReferenceCounted retain()
ReferenceCounted1.retain in interface ReferenceCountedpublic final ReferenceCounted retain(int increment)
ReferenceCountedincrement.retain in interface ReferenceCountedpublic final ReferenceCounted touch()
ReferenceCountedResourceLeakDetector. This method is a shortcut to touch(null).touch in interface ReferenceCountedpublic final ReferenceCounted touch(Object hint)
ReferenceCountedResourceLeakDetector.touch in interface ReferenceCountedpublic final boolean release()
ReferenceCounted1 and deallocates this object if the reference count reaches at
0.release in interface ReferenceCountedtrue if and only if the reference count became 0 and this object has been deallocatedpublic final boolean release(int decrement)
ReferenceCounteddecrement and deallocates this object if the reference
count reaches at 0.release in interface ReferenceCountedtrue if and only if the reference count became 0 and this object has been deallocatedpublic String getApplicationProtocol()
getApplicationProtocol in class SSLEnginepublic String getHandshakeApplicationProtocol()
getHandshakeApplicationProtocol in class SSLEnginepublic final SSLSession getHandshakeSession()
getHandshakeSession in class SSLEnginepublic 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 SSLEngineSSLExceptionpublic final SSLEngineResult unwrap(ByteBuffer[] srcs, int srcsOffset, int srcsLength, ByteBuffer[] dsts, int dstsOffset, int dstsLength) throws SSLException
SSLExceptionpublic final SSLEngineResult unwrap(ByteBuffer[] srcs, ByteBuffer[] dsts) throws SSLException
SSLExceptionpublic final SSLEngineResult unwrap(ByteBuffer src, ByteBuffer[] dsts, int offset, int length) throws SSLException
unwrap in class SSLEngineSSLExceptionpublic final SSLEngineResult wrap(ByteBuffer src, ByteBuffer dst) throws SSLException
wrap in class SSLEngineSSLExceptionpublic final SSLEngineResult unwrap(ByteBuffer src, ByteBuffer dst) throws SSLException
unwrap in class SSLEngineSSLExceptionpublic final SSLEngineResult unwrap(ByteBuffer src, ByteBuffer[] dsts) throws SSLException
unwrap in class SSLEngineSSLExceptionpublic final Runnable getDelegatedTask()
getDelegatedTask in class SSLEnginepublic final void closeInbound()
throws SSLException
closeInbound in class SSLEngineSSLExceptionpublic final boolean isInboundDone()
isInboundDone in class SSLEnginepublic final void closeOutbound()
closeOutbound in class SSLEnginepublic final boolean isOutboundDone()
isOutboundDone in class SSLEnginepublic final String[] getSupportedCipherSuites()
getSupportedCipherSuites in class SSLEnginepublic final String[] getEnabledCipherSuites()
getEnabledCipherSuites in class SSLEnginepublic final void setEnabledCipherSuites(String[] cipherSuites)
setEnabledCipherSuites in class SSLEnginepublic final String[] getSupportedProtocols()
getSupportedProtocols in class SSLEnginepublic final String[] getEnabledProtocols()
getEnabledProtocols in class SSLEnginepublic final void setEnabledProtocols(String[] protocols)
setEnabledProtocols in class SSLEnginepublic final SSLSession getSession()
getSession in class SSLEnginepublic final void beginHandshake()
throws SSLException
beginHandshake in class SSLEngineSSLExceptionpublic final SSLEngineResult.HandshakeStatus getHandshakeStatus()
getHandshakeStatus in class SSLEnginepublic final void setUseClientMode(boolean clientMode)
setUseClientMode in class SSLEnginepublic final boolean getUseClientMode()
getUseClientMode in class SSLEnginepublic final void setNeedClientAuth(boolean b)
setNeedClientAuth in class SSLEnginepublic final boolean getNeedClientAuth()
getNeedClientAuth in class SSLEnginepublic final void setWantClientAuth(boolean b)
setWantClientAuth in class SSLEnginepublic 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 SSLEnginepublic final boolean getEnableSessionCreation()
getEnableSessionCreation in class SSLEnginepublic final SSLParameters getSSLParameters()
getSSLParameters in class SSLEnginepublic final void setSSLParameters(SSLParameters sslParameters)
setSSLParameters in class SSLEnginepublic String getNegotiatedApplicationProtocol()
null if the negotiation failed or the client does not have ALPN/NPN extensionCopyright © 2008–2025 The Netty Project. All rights reserved.