Package org.jboss.netty.handler.ssl
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 int
0 - not accepted, 1 - accepted implicitly via wrap()/unwrap(), 2 - accepted explicitly via beginHandshake() callprivate String
private final SslBufferPool
private String
private int
private static final AtomicIntegerFieldUpdater
<OpenSslEngine> private static final Certificate[]
private static final X509Certificate[]
private static final SSLException
private static final SSLException
private boolean
private final String
private boolean
private boolean
private boolean
private int
private static final InternalLogger
private static final int
private static final int
(package private) static final int
private static final int
private long
private boolean
private static final SSLException
private SSLSession
private long
-
Constructor Summary
ConstructorsConstructorDescriptionOpenSslEngine
(long sslCtx, SslBufferPool bufPool, String fallbackApplicationProtocol) Creates a new instance -
Method Summary
Modifier and TypeMethodDescriptionvoid
private void
void
void
String[]
String[]
boolean
private SSLEngineResult.Status
boolean
String[]
String[]
boolean
boolean
boolean
boolean
private int
readEncryptedData
(ByteBuffer dst, int pending) Read encrypted data from the OpenSSL network BIOprivate int
Read plaintext data from the OpenSSL internal BIOvoid
setEnabledCipherSuites
(String[] strings) void
setEnabledProtocols
(String[] strings) void
setEnableSessionCreation
(boolean b) void
setNeedClientAuth
(boolean b) void
setUseClientMode
(boolean clientMode) void
setWantClientAuth
(boolean b) void
shutdown()
Destroys this engine.unwrap
(ByteBuffer src, ByteBuffer[] dsts, int offset, int length) wrap
(ByteBuffer[] srcs, int offset, int length, ByteBuffer dst) private int
Write encrypted data to the OpenSSL network BIOprivate int
Write plaintext data to the OpenSSL internal BIO Calling this function with src.remaining == 0 is undefined.Methods inherited from class javax.net.ssl.SSLEngine
getApplicationProtocol, getHandshakeApplicationProtocol, getHandshakeApplicationProtocolSelector, getHandshakeSession, getPeerHost, getPeerPort, getSSLParameters, setHandshakeApplicationProtocolSelector, setSSLParameters, unwrap, unwrap, wrap, wrap
-
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_CTX
objectbufPool
- theSslBufferPool
that 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:
wrap
in classSSLEngine
- Throws:
SSLException
-
unwrap
public SSLEngineResult unwrap(ByteBuffer src, ByteBuffer[] dsts, int offset, int length) throws SSLException - Specified by:
unwrap
in classSSLEngine
- Throws:
SSLException
-
getDelegatedTask
- Specified by:
getDelegatedTask
in classSSLEngine
-
closeInbound
- Specified by:
closeInbound
in classSSLEngine
- Throws:
SSLException
-
isInboundDone
public boolean isInboundDone()- Specified by:
isInboundDone
in classSSLEngine
-
closeOutbound
public void closeOutbound()- Specified by:
closeOutbound
in classSSLEngine
-
isOutboundDone
public boolean isOutboundDone()- Specified by:
isOutboundDone
in classSSLEngine
-
getSupportedCipherSuites
- Specified by:
getSupportedCipherSuites
in classSSLEngine
-
getEnabledCipherSuites
- Specified by:
getEnabledCipherSuites
in classSSLEngine
-
setEnabledCipherSuites
- Specified by:
setEnabledCipherSuites
in classSSLEngine
-
getSupportedProtocols
- Specified by:
getSupportedProtocols
in classSSLEngine
-
getEnabledProtocols
- Specified by:
getEnabledProtocols
in classSSLEngine
-
setEnabledProtocols
- Specified by:
setEnabledProtocols
in classSSLEngine
-
getSession
- Specified by:
getSession
in classSSLEngine
-
beginHandshake
- Specified by:
beginHandshake
in classSSLEngine
- Throws:
SSLException
-
beginHandshakeImplicitly
- Throws:
SSLException
-
getEngineStatus
-
getHandshakeStatus
- Specified by:
getHandshakeStatus
in classSSLEngine
-
setUseClientMode
public void setUseClientMode(boolean clientMode) - Specified by:
setUseClientMode
in classSSLEngine
-
getUseClientMode
public boolean getUseClientMode()- Specified by:
getUseClientMode
in classSSLEngine
-
setNeedClientAuth
public void setNeedClientAuth(boolean b) - Specified by:
setNeedClientAuth
in classSSLEngine
-
getNeedClientAuth
public boolean getNeedClientAuth()- Specified by:
getNeedClientAuth
in classSSLEngine
-
setWantClientAuth
public void setWantClientAuth(boolean b) - Specified by:
setWantClientAuth
in classSSLEngine
-
getWantClientAuth
public boolean getWantClientAuth()- Specified by:
getWantClientAuth
in classSSLEngine
-
setEnableSessionCreation
public void setEnableSessionCreation(boolean b) - Specified by:
setEnableSessionCreation
in classSSLEngine
-
getEnableSessionCreation
public boolean getEnableSessionCreation()- Specified by:
getEnableSessionCreation
in classSSLEngine
-