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.
限定符和类型 | 方法和说明 |
---|---|
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)
|
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
在接口中 ReferenceCounted
public final ReferenceCounted retain()
ReferenceCounted
1
.retain
在接口中 ReferenceCounted
public final ReferenceCounted retain(int increment)
ReferenceCounted
increment
.retain
在接口中 ReferenceCounted
public final boolean release()
ReferenceCounted
1
and deallocates this object if the reference count reaches at
0
.release
在接口中 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
在接口中 ReferenceCounted
true
if and only if the reference count became 0
and this object has been deallocatedpublic final javax.net.ssl.SSLSession getHandshakeSession()
getHandshakeSession
在类中 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
在类中 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
在类中 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
在类中 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
在类中 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
在类中 javax.net.ssl.SSLEngine
javax.net.ssl.SSLException
public final java.lang.Runnable getDelegatedTask()
getDelegatedTask
在类中 javax.net.ssl.SSLEngine
public final void closeInbound() throws javax.net.ssl.SSLException
closeInbound
在类中 javax.net.ssl.SSLEngine
javax.net.ssl.SSLException
public final boolean isInboundDone()
isInboundDone
在类中 javax.net.ssl.SSLEngine
public final void closeOutbound()
closeOutbound
在类中 javax.net.ssl.SSLEngine
public final boolean isOutboundDone()
isOutboundDone
在类中 javax.net.ssl.SSLEngine
public final java.lang.String[] getSupportedCipherSuites()
getSupportedCipherSuites
在类中 javax.net.ssl.SSLEngine
public final java.lang.String[] getEnabledCipherSuites()
getEnabledCipherSuites
在类中 javax.net.ssl.SSLEngine
public final void setEnabledCipherSuites(java.lang.String[] cipherSuites)
setEnabledCipherSuites
在类中 javax.net.ssl.SSLEngine
public final java.lang.String[] getSupportedProtocols()
getSupportedProtocols
在类中 javax.net.ssl.SSLEngine
public final java.lang.String[] getEnabledProtocols()
getEnabledProtocols
在类中 javax.net.ssl.SSLEngine
public final void setEnabledProtocols(java.lang.String[] protocols)
setEnabledProtocols
在类中 javax.net.ssl.SSLEngine
public final javax.net.ssl.SSLSession getSession()
getSession
在类中 javax.net.ssl.SSLEngine
public final void beginHandshake() throws javax.net.ssl.SSLException
beginHandshake
在类中 javax.net.ssl.SSLEngine
javax.net.ssl.SSLException
public final javax.net.ssl.SSLEngineResult.HandshakeStatus getHandshakeStatus()
getHandshakeStatus
在类中 javax.net.ssl.SSLEngine
public final void setUseClientMode(boolean clientMode)
setUseClientMode
在类中 javax.net.ssl.SSLEngine
public final boolean getUseClientMode()
getUseClientMode
在类中 javax.net.ssl.SSLEngine
public final void setNeedClientAuth(boolean b)
setNeedClientAuth
在类中 javax.net.ssl.SSLEngine
public final boolean getNeedClientAuth()
getNeedClientAuth
在类中 javax.net.ssl.SSLEngine
public final void setWantClientAuth(boolean b)
setWantClientAuth
在类中 javax.net.ssl.SSLEngine
public final boolean getWantClientAuth()
getWantClientAuth
在类中 javax.net.ssl.SSLEngine
@UnstableApi public final void setVerify(int verifyMode, int depth)
public final void setEnableSessionCreation(boolean b)
setEnableSessionCreation
在类中 javax.net.ssl.SSLEngine
public final boolean getEnableSessionCreation()
getEnableSessionCreation
在类中 javax.net.ssl.SSLEngine
public final javax.net.ssl.SSLParameters getSSLParameters()
getSSLParameters
在类中 javax.net.ssl.SSLEngine
public final void setSSLParameters(javax.net.ssl.SSLParameters sslParameters)
setSSLParameters
在类中 javax.net.ssl.SSLEngine
public java.lang.String getNegotiatedApplicationProtocol()
null
if the negotiation failed or the client does not have ALPN/NPN extension