Package org.mozilla.jss.ssl.javax
Class JSSEngineReferenceImpl
java.lang.Object
javax.net.ssl.SSLEngine
org.mozilla.jss.ssl.javax.JSSEngine
org.mozilla.jss.ssl.javax.JSSEngineReferenceImpl
The reference JSSEngine implementation.
This JSSEngine implementation is a reference for future JSSEngine
implementations, providing a pure-Java overview of what should happen at
each step of the init, wrap, and unwrap calls.
This implementation allows for extended debug logging, but also debug
packet logging. The latter writes out packets sent via wrap(...) and
received from unwrap(...) to a port on localhost. This allows one to easily
attach Wireshark or tcpdump and inspect the TLS packets, even if errors
occur during the test suite (where packets aren't sent over the wire by
default). This maintains the client/server relationship, and are logged
as being from the appropriate side of the TLS connection.
-
Field Summary
Fields inherited from class org.mozilla.jss.ssl.javax.JSSEngine
as_server, BUFFER_SIZE, cert, certAlias, config, enabled_ciphers, handshake_state, hostname, is_inbound_closed, is_outbound_closed, key, key_managers, logger, max_protocol, min_protocol, need_client_auth, serverTemplates, session, ssl_fd, trust_managers, want_client_auth
-
Constructor Summary
ConstructorsConstructorDescriptionJSSEngineReferenceImpl
(String peerHost, int peerPort) JSSEngineReferenceImpl
(String peerHost, int peerPort, X509Certificate localCert, PrivateKey localKey) -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
cleanup()
Performs cleanup of internal data, closing both inbound and outbound data streams if still open.void
void
void
enableSafeDebugLogging
(int port) Enable writing of encrypted TLS traffic to the specified port in a client-server relationship (mirroring the actual role of this SSLEngine) to enable debugging with Wireshark.protected void
finalize()
Gets the current security status of this JSSEngine instance.protected void
Implementation-specific handler to handle reconfiguration of client authentication after the handshake has completed.void
Set the name of this JSSEngine instance, to be printed in logging calls.void
Calls cleanup only if both inbound and outbound data streams are closed.unwrap
(ByteBuffer src, ByteBuffer[] dsts, int offset, int length) wrap
(ByteBuffer[] srcs, int offset, int length, ByteBuffer dst) int
writeData
(ByteBuffer[] srcs, int offset, int length) Methods inherited from class org.mozilla.jss.ssl.javax.JSSEngine
addConfiguration, errorText, fireAlertReceived, fireAlertSent, fireHandshakeComplete, getDefaultConfiguration, getEnabledCipherSuites, getEnabledProtocols, getEnableSessionCreation, getListeners, getNeedClientAuth, getServerTemplate, getSession, getSSLFDProxy, getSSLParameters, getSupportedCipherSuites, getSupportedProtocols, getUseClientMode, getWantClientAuth, initializeSessionCache, isInboundDone, isOutboundDone, queryEnabledCipherSuites, queryEnabledProtocols, removeConfiguration, setCertFromAlias, setConfiguration, setEnabledCipherSuites, setEnabledCipherSuites, setEnabledProtocols, setEnabledProtocols, setEnabledProtocols, setEnableSessionCreation, setHostname, setKeyManager, setKeyManagers, setKeyMaterials, setListeners, setNeedClientAuth, setSSLParameters, setTrustManager, setTrustManagers, setUseClientMode, setWantClientAuth
Methods inherited from class javax.net.ssl.SSLEngine
getApplicationProtocol, getHandshakeApplicationProtocol, getHandshakeApplicationProtocolSelector, getHandshakeSession, getPeerHost, getPeerPort, setHandshakeApplicationProtocolSelector, unwrap, unwrap, wrap, wrap
-
Constructor Details
-
JSSEngineReferenceImpl
public JSSEngineReferenceImpl() -
JSSEngineReferenceImpl
-
JSSEngineReferenceImpl
public JSSEngineReferenceImpl(String peerHost, int peerPort, X509Certificate localCert, PrivateKey localKey)
-
-
Method Details
-
setName
Set the name of this JSSEngine instance, to be printed in logging calls. This helps when debugging output from multiple JSSEngine instances at the same time, such as within the JSS test suite. -
reconfigureClientAuth
protected void reconfigureClientAuth()Description copied from class:JSSEngine
Implementation-specific handler to handle reconfiguration of client authentication after the handshake has completed. Note that this always gets called, regardless of if the handshake has started; it is up to the implementation to handle this appropriately.- Specified by:
reconfigureClientAuth
in classJSSEngine
-
beginHandshake
- Specified by:
beginHandshake
in classSSLEngine
- Throws:
SSLException
-
closeInbound
public void closeInbound()- Specified by:
closeInbound
in classSSLEngine
-
closeOutbound
public void closeOutbound()- Specified by:
closeOutbound
in classSSLEngine
-
getHostname
-
getDelegatedTask
- Specified by:
getDelegatedTask
in classSSLEngine
-
getHandshakeStatus
- Specified by:
getHandshakeStatus
in classSSLEngine
-
getStatus
Description copied from class:JSSEngine
Gets the current security status of this JSSEngine instance. This is abstract to allow implementations to implement this (and step their handshake mechanism) as they wish. -
enableSafeDebugLogging
public void enableSafeDebugLogging(int port) Enable writing of encrypted TLS traffic to the specified port in a client-server relationship (mirroring the actual role of this SSLEngine) to enable debugging with Wireshark. -
unwrap
public SSLEngineResult unwrap(ByteBuffer src, ByteBuffer[] dsts, int offset, int length) throws IllegalArgumentException, SSLException - Specified by:
unwrap
in classSSLEngine
- Throws:
IllegalArgumentException
SSLException
-
writeData
-
wrap
public SSLEngineResult wrap(ByteBuffer[] srcs, int offset, int length, ByteBuffer dst) throws IllegalArgumentException, SSLException - Specified by:
wrap
in classSSLEngine
- Throws:
IllegalArgumentException
SSLException
-
tryCleanup
public void tryCleanup()Calls cleanup only if both inbound and outbound data streams are closed. This prevents accidental cleanup in the case of a partially open connection.- Specified by:
tryCleanup
in classJSSEngine
-
cleanup
public void cleanup()Performs cleanup of internal data, closing both inbound and outbound data streams if still open. -
finalize
protected void finalize()
-