Class OpenSslEngine
java.lang.Object
javax.net.ssl.SSLEngine
org.jboss.netty.handler.ssl.OpenSslEngine
Implements a
SSLEngine using
OpenSSL BIO abstractions.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int0 - not accepted, 1 - accepted implicitly via wrap()/unwrap(), 2 - accepted explicitly via beginHandshake() callprivate Stringprivate final SslBufferPoolprivate Stringprivate intprivate static final AtomicIntegerFieldUpdater<OpenSslEngine> private static final Certificate[]private static final X509Certificate[]private static final SSLExceptionprivate static final SSLExceptionprivate booleanprivate final Stringprivate booleanprivate booleanprivate booleanprivate intprivate static final InternalLoggerprivate static final intprivate static final int(package private) static final intprivate static final intprivate longprivate booleanprivate static final SSLExceptionprivate SSLSessionprivate long -
Constructor Summary
ConstructorsConstructorDescriptionOpenSslEngine(long sslCtx, SslBufferPool bufPool, String fallbackApplicationProtocol) Creates a new instance -
Method Summary
Modifier and TypeMethodDescriptionvoidprivate voidvoidvoidString[]String[]booleanprivate SSLEngineResult.StatusbooleanString[]String[]booleanbooleanbooleanbooleanprivate intreadEncryptedData(ByteBuffer dst, int pending) Read encrypted data from the OpenSSL network BIOprivate intRead plaintext data from the OpenSSL internal BIOvoidsetEnabledCipherSuites(String[] strings) voidsetEnabledProtocols(String[] strings) voidsetEnableSessionCreation(boolean b) voidsetNeedClientAuth(boolean b) voidsetUseClientMode(boolean clientMode) voidsetWantClientAuth(boolean b) voidshutdown()Destroys this engine.unwrap(ByteBuffer src, ByteBuffer[] dsts, int offset, int length) wrap(ByteBuffer[] srcs, int offset, int length, ByteBuffer dst) private intWrite encrypted data to the OpenSSL network BIOprivate intWrite plaintext data to the OpenSSL internal BIO Calling this function with src.remaining == 0 is undefined.
-
Field Details
-
logger
-
EMPTY_CERTIFICATES
-
EMPTY_X509_CERTIFICATES
-
ENGINE_CLOSED
-
RENEGOTIATION_UNSUPPORTED
-
ENCRYPTED_PACKET_OVERSIZED
-
MAX_PLAINTEXT_LENGTH
private static final int MAX_PLAINTEXT_LENGTH- See Also:
-
MAX_COMPRESSED_LENGTH
private static final int MAX_COMPRESSED_LENGTH- See Also:
-
MAX_CIPHERTEXT_LENGTH
private static final int MAX_CIPHERTEXT_LENGTH- See Also:
-
MAX_ENCRYPTED_PACKET_LENGTH
static final int MAX_ENCRYPTED_PACKET_LENGTH- See Also:
-
DESTROYED_UPDATER
-
ssl
private long ssl -
networkBIO
private long networkBIO -
accepted
private int accepted0 - not accepted, 1 - accepted implicitly via wrap()/unwrap(), 2 - accepted explicitly via beginHandshake() call -
handshakeFinished
private boolean handshakeFinished -
receivedShutdown
private boolean receivedShutdown -
destroyed
private volatile int destroyed -
cipher
-
applicationProtocol
-
isInboundDone
private boolean isInboundDone -
isOutboundDone
private boolean isOutboundDone -
engineClosed
private boolean engineClosed -
lastPrimingReadResult
private int lastPrimingReadResult -
bufPool
-
fallbackApplicationProtocol
-
session
-
-
Constructor Details
-
OpenSslEngine
Creates a new instance- Parameters:
sslCtx- an OpenSSLSSL_CTXobjectbufPool- theSslBufferPoolthat will be used by this engine
-
-
Method Details
-
shutdown
public void shutdown()Destroys this engine. -
writePlaintextData
Write plaintext data to the OpenSSL internal BIO Calling this function with src.remaining == 0 is undefined. -
writeEncryptedData
Write encrypted data to the OpenSSL network BIO -
readPlaintextData
Read plaintext data from the OpenSSL internal BIO -
readEncryptedData
Read encrypted data from the OpenSSL network BIO -
wrap
public SSLEngineResult wrap(ByteBuffer[] srcs, int offset, int length, ByteBuffer dst) throws SSLException - Specified by:
wrapin classSSLEngine- Throws:
SSLException
-
unwrap
public SSLEngineResult unwrap(ByteBuffer src, ByteBuffer[] dsts, int offset, int length) throws SSLException - Specified by:
unwrapin classSSLEngine- Throws:
SSLException
-
getDelegatedTask
- Specified by:
getDelegatedTaskin classSSLEngine
-
closeInbound
- Specified by:
closeInboundin classSSLEngine- Throws:
SSLException
-
isInboundDone
public boolean isInboundDone()- Specified by:
isInboundDonein classSSLEngine
-
closeOutbound
public void closeOutbound()- Specified by:
closeOutboundin classSSLEngine
-
isOutboundDone
public boolean isOutboundDone()- Specified by:
isOutboundDonein classSSLEngine
-
getSupportedCipherSuites
- Specified by:
getSupportedCipherSuitesin classSSLEngine
-
getEnabledCipherSuites
- Specified by:
getEnabledCipherSuitesin classSSLEngine
-
setEnabledCipherSuites
- Specified by:
setEnabledCipherSuitesin classSSLEngine
-
getSupportedProtocols
- Specified by:
getSupportedProtocolsin classSSLEngine
-
getEnabledProtocols
- Specified by:
getEnabledProtocolsin classSSLEngine
-
setEnabledProtocols
- Specified by:
setEnabledProtocolsin classSSLEngine
-
getSession
- Specified by:
getSessionin classSSLEngine
-
beginHandshake
- Specified by:
beginHandshakein classSSLEngine- Throws:
SSLException
-
beginHandshakeImplicitly
- Throws:
SSLException
-
getEngineStatus
-
getHandshakeStatus
- Specified by:
getHandshakeStatusin classSSLEngine
-
setUseClientMode
public void setUseClientMode(boolean clientMode) - Specified by:
setUseClientModein classSSLEngine
-
getUseClientMode
public boolean getUseClientMode()- Specified by:
getUseClientModein classSSLEngine
-
setNeedClientAuth
public void setNeedClientAuth(boolean b) - Specified by:
setNeedClientAuthin classSSLEngine
-
getNeedClientAuth
public boolean getNeedClientAuth()- Specified by:
getNeedClientAuthin classSSLEngine
-
setWantClientAuth
public void setWantClientAuth(boolean b) - Specified by:
setWantClientAuthin classSSLEngine
-
getWantClientAuth
public boolean getWantClientAuth()- Specified by:
getWantClientAuthin classSSLEngine
-
setEnableSessionCreation
public void setEnableSessionCreation(boolean b) - Specified by:
setEnableSessionCreationin classSSLEngine
-
getEnableSessionCreation
public boolean getEnableSessionCreation()- Specified by:
getEnableSessionCreationin classSSLEngine
-